Flot charts, xaxis minimum length - flot

The xaxis in my flot line charts can take an array of data up to but no more than 16 in length. The problem is when my data is less than 16, the x axis is spreading out to show the maximum value of whatever the length of the data array is.
Even if my data is say 4 in length, i'd still like to show 16 points on the xaxis.
I have tried various configs and nothing seems to be working :(
http://www.discussthemarket.com/ratings/
The graphs lower down have an x axis greater than the graphs nearer the top which have fewer items in the data. I'd like to consistently apply a fixed length of 16 to the x axis but am really struggling.

One possibility is to provide a number for the ticks option:
ticks: 16
However that is treated only as a guideline; Flot always tries to make the ticks fit, and will reduce the number when it detects that they would overlap or run off the side of the plot. If you really want to force it to use 16 (which I wouldn't recommend, since the labels will probably overlap) you'll need to manually provide an array of ticks:
ticks: [0, 5, 10, ...]

I've cracked it byadding another data set which is 16 in length but has lines:{show:false} set :) job done!

You can use minTickSize according to the documentation of flot.
minTickSize : [1, "day"],

Related

show dates in xticks only where value exist in plot chart and hide unnecessary interpolated xtick labels [duplicate]

Could someone please guide me on how should I make sure that all ticks (or maybe a better way to specify will be to say all elements in the list passed to plot function) are displayed on the x axis when using matplotlib to plot graphs?
plt.plot(xValues, meanWeekdayArrivalCounts, 'k-')
I want all the values in the list xValues to show up on the graph. By default, only, 0, 10, 20, 30, 40, 50 show up.
Simply add plt.xticks(xValues) to your code. Given the number of points in your graph, the labels might clutter.
You could display them as minor ticks if you set them on the axes object with ax.set_xticks(xValues, minor=True).
use this.
fig = plt.figure(figsize=(10,8))
plt.xticks(np.arange(min(x), max(x)+1, 1.0))
I wanted to show all the years in my graph so I did
plt.xticks(list(table_05.anio.unique()))

How to configure chart.js line chart with very low minimum height, and only 0 and 1 (no decimals) as ticks on the y-axis

I'm trying to tailor the chart above to take up as little vertical space as possible. It is a line chart showing binary data (1 or 0 for door open or closed), but it seems to force me to have the decimal ticks between the two values, even thought every point's y-axis value is 1 or 0 as integers. Ideally it would be no taller than the width of the y-axis label.
Is this possible? I've tried various things to do with the container, removing y-axis ticks etc, but I'm struggling to get it more compact than this.
UPDATE:
I've managed to get rid of the decimal ticks with config from these docs. Still no luck on the height...is there an undocumented minimum or something?
Per this question, the answer is to set a fixed height on the chart canvas.
Fix the height of Y-Axis of Bar chart in chart.js?

custom number format in excel for disk or memory sizes

I'm trying to draw a graph where the y-axis is disk sizes.
And I have sizes ranging from 2 kilobytes through about 22 petabytes.
Represented as numbers that is ~2000 to 22e12
This looks pretty bad on a chart axis.
I could set the scale to "thousands" and then I'd be left with numbers between 2 and 22e9 and the reader is left to do the math that 22e9 (thousand) bytes is 22 petabytes and stuff like that.
But that's not intuitive.
So I tried a custom format.
I know that I can do
[Red][>1000000000];[Blue][>1000000]
but only two can be provided in this way.
I also know that I can do stuff for positive, negative and zero as well.
But is there a way in which I can accomplish the following:
(a) cell values are numbers, sizes in bytes, kilobytes or some such unit
(b) graph shows y axis with these numbers
(c) y-axis is logarithmic (very important)
(d) the y-axis labels are converted to K, M, G or P bytes as appropriate
If you think you have a solution, please verify it with this sample data:
1990, 2050
1992, 21246
1993, 208557
1996, 20971520
2000, 306184192
2012, 1.75922E+14
Your graph should be an X-Y Scatter (with lines)
Your graph should include the numbers in the first column as the x-axis on a linear scale
Your graph should include the numbers in the second column as the y-axis on a logarithmic scale
Your graph should have y-axis legends like "1K", "10K", "100K", "1M", "10M", "100M", ... "1P" and so on at the appropriate points.
This same solution would also be obviously applicable for money, where you want to show numbers in thousands, millions or billions with the appropriate suffix and a small number.
Try this to convert a string value in the form 99.9G to 99.9E^9 value
=CHOOSE(SEARCH(RIGHT(B5),"kMG"), 10^3,10^6,10^9)*VALUE(LEFT(B5,LEN(B5)-1))

Flot xaxis ticks exceeds the specified number

I'm new to Flot, so my understanding of ticks is the number of columns that flot will draw on the chart.
As my labels are quite long, having 6 ticks fits nicely. But most times, it just exceeds the number I set, and that screws up the labels.
I assume this has to do with Flot's algorithm? Is there any way I can fix it to 6 columns?
A simplet of how I set it.
xaxis: { mode: 'time', timeformat: "%y/%m/%d %H:%M:%S", tick:6 },
The ticks option is a guideline. Flot tries to match that value, but its first priority is to choose 'round' values, i.e. 5:00 instead of 5:01.
There are several ways to work around this, depending on your data. The guaranteed solution is to calculate your six tick values manually, and provide them to Flot in the 'ticks' array option. Besides that, you may be able to coax Flot into generating the correct number of ticks by adjusting the minTickSize and axis min/max.

How to use Excel column chart for datasets that have very different scales

There are 2 datasets that have values in the interval [0; 1]. I need to visualize these 2 datasets in Excel as a column chart. The problem is that some data points have values 0.0001, 0.0002, and other data point have values 0.8, 0.9, etc. So, the difference is hugde, and therefore it´s impossible to see data points with small values. What could be the solution? Should I use logarithmic scale? I appreciate any example.
Two possible ways below
Graph the smaller data set as a second series against a right hand Y axis (with same ratio from min to max as left hand series)
Multiply the smaller data set by 1000 and compare the multiplied data set to the larger one
Note that a log scale will give negative results given you are working with fractions, so that isn't really an option

Resources