I have the following Graph: The Y values are located at X= 32,64,128,256, 512 and 1024. However, the graph shows different values. I would like to show for X-axis labels only the relevant values (i.e.32,64,128,256, 512 and 1024).
In addition, I would like to add the maximal value of 1 to Y-axis. As can be seen I defined the maximal value to be 1 but the graph doesn't show it.
How can I fix these 2 issues both in X-axis and in Y-axis?
For the X-axis: tick the check box "Logarithmic scale" and set the Base to 2.
For the Y-axis: set the Minimum to a value that is divisible by the Major unit 0.1, for example to 0.4.
Thanks to Hans Vogelaar (http://www.eileenslounge.com) for the answer.
Related
For simplicity let's assume we have a function sin(x) and calculated 1000 samples between -1 and 1 with it. We can plot those samples. Now in the next step we want to plot the integral of sin(x) which would be - cos(x) + C. Now i can calculate the integral with my existing samples like this:
y[n] = x[n] + y[n-1]
Because it's a cumulative sum we will need to normalize it to get samples between -1 and 1 on the y axis.
y = 2 * ( x - min(x) / max(x) - min(x) ) - 1
To normalize we need a maximum and a minimum.
Now we want to calculate the next 1000 samples for sin(x) and calculate the integral again. Because it's a cumulative sum we will have a new maximum which means we will need to normalize all of our 2000 samples.
Now my question basically is:
How can i normalize samples in this context without knowing the maximum and minimum?
How can i prevent, to normalize all previous samples again, if i have a new set of samples with a new maximum/minimum?
I've found a solution :)
I also want to mention: This is about periodic functions like Sine, so basically the maximum and minimum should be always the same, right?
In a special case this isn't true:
If you samples don't contain a full period of the function (with global maximum and minimum of the function). This can happen when you choose a very low frequency.
What can you do:
Simply calculate the samples for a function like sin(x) with a
frequency of 1. It will contain the global maximum and minimum of the function (it's important that y varies between -1 and 1, not 0 and 1!).
Then you calculate the integral with the cumulative sum.
get maximum and minimum of the samples
you can scale it up or down: maximum/frequency, minimum/frequency
can be used now to normalize samples which were calculated with any other frequency.
It only need to be calculated once at the beginning.
From https://en.wikipedia.org/wiki/Box_plot
The whisker of the box plot has the following possible definitions:
the minimum and maximum of all of the data[1]
the lowest datum still within 1.5 IQR of the lower quartile, and the highest datum still within 1.5 IQR of the upper quartile
one standard deviation above and below the mean of the data
the 9th percentile and the 91st percentile
the 2nd percentile and the 98th percentile.
I am wondering in the pandas:
df['data'].plot(kind = 'box', sym='bD')
which definition is the whisker using?
Also, for the matplotlib library:
ax.boxplot(dfa.duration)
which definition is the whisker using?
Thanks!
The boxplot documentaton says about the whiskers
whis : float, sequence, or string (default = 1.5)
As a float, determines the reach of the whiskers to the beyond the first and third quartiles. In other words, where IQR is the interquartile range (Q3-Q1), the upper whisker will extend to last datum less than Q3 + whisIQR). Similarly, the lower whisker will extend to the first datum greater than Q1 - whisIQR. Beyond the whiskers, data are considered outliers and are plotted as individual points. Set this to an unreasonably high value to force the whiskers to show the min and max values. Alternatively, set this to an ascending sequence of percentile (e.g., [5, 95]) to set the whiskers at specific percentiles of the data. Finally, whis can be the string 'range' to force the whiskers to the min and max of the data.
The only definition from the list from the question which cannot be easily implemented is the "one standard deviation", all others are readily set with this argument. The default is the 1.5IQR definition.
The pandas.DataFrame.boxplot calls the matplotlib function. Hence they should be identical.
I want to modify to y axis in "image1" so that the values range from 0 to 7 rather than from 0 to 18.
I attach my example (image1) and an original example (image3)
thank you for your help
Image 1
Image 3
click on your graph. Select the Y axis. Set you min and max values to what you want instead of automatic.
In Excel 2010 is it possible to have X and Y categories in a scatter/line graph?
An example would be Simple, Intermediate, Complex on the X axis and Low, Medium, High on the Y axis and three markers in the plot area corresponding to Simple/Low, Intermediate/Medium and Complex/High.
Thanks.
You have to get some numbers in your dataset. A scatter between to categories is in my opinion can't be plotted and also it doesn't have any utility as such.
You can have your categories on one axis (Say X) and some values in another axis( Say Y), then you can plot the graph.
Your categories should be unique for scatters, if a single category comes more than once excel will auto change the categories to number from 1, 2, 3, ....
I need to show values in bar graph. I am drawing the bars using CALayer. And there are only three bars in my case. And the bar height changes for different values. I am drawing each bar as a rectangle of variable height( height according to pixcel value).
I am able to draw the maximum height as 300 pix. But, the values in y-axis (height) are
1, 4, 10
1000, 230, 12000
in this way.
How can I scale these values to pixel values? I have to show the values in y-axis ?
Thank you,
This might be a little bit of an old post but why couldnt you take your max possible value:
Say it can never exceed 12,000 / max size you can plot.
Then when you create your bars, the size is that % of it.
Example
1, 2, 5, 100, 1000, 10000, 20000
Assuming your max height was 300px...
Take the largest number 20,000 and divide by the largest pixel size possible 300px
You get .015 percent.
This means you multiply each value by .015 and plot it and it should show you a true to scale graph of the values.