I need to plot a logarithmic y-axis
between 0 and 1 like the graph in the picture.
I need the points on the y-axis
to be [0.005,0.010,0.050,0.100,0.500,1] like the graph in the picture. how can I choose which values will show on the axis?
Asked
Active
Viewed 462 times
0

Mir Rahed Uddin
- 1,208
- 2
- 12
- 25

KerenK
- 1
- 7
-
1You should try to cut your code down to a Minimum Working Example so it's easier for us to help you. – Joe Todd Dec 01 '20 at 18:30
-
I cut it down as much as I could and edited it – KerenK Dec 01 '20 at 18:37
-
The short answer is that you're passing a dataframe into a function that has a boolean expression that is expecting a single value. try "isinstance(a, pd.DataFrame)" and you'll see as you debug that it isn't something easy to define as "less than" – Marc Maxmeister Dec 01 '20 at 18:38
-
Does this answer your question? [ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()](https://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous) – Simon Notley Dec 01 '20 at 18:47
-
I'm trying your code and this function redefines itself: ``` def optical_depth_fixed_source(z_source, f_dm, m_lens, dt_min, r_max): optical_depth_fixed_source = integrate.quad(optical_depth_fixed_source_integrand, 0, z_source, args=(z_source, f_dm, m_lens, dt_min, r_max), epsabs=1e-3,epsrel=1e-3)[0] return optical_depth_fixed_source ``` – Marc Maxmeister Dec 01 '20 at 18:48
-
what do you mean redefines itself? – KerenK Dec 01 '20 at 19:07
-
the first line in that function assigns the output of that line to a variable that is identical to the name of the function itself. This is going to lead to bugs. You can just `return` that result instead. – Marc Maxmeister Dec 01 '20 at 19:38
1 Answers
0
use plt.yscale('log')
to make logarithmic scale and plt.axis([1,10000,0.004,1])
for plot borders
use plt.yticks([0.005,0.010,0.050,0.100,0.500,1],[0.005,0.010,0.050,0.100,0.500,1])
to choose the values that will show
plt.yticks([points],[names])

KerenK
- 1
- 7