Am quite new to Flot, and am wondering if there is a way to change the x axis title as I pan.
Each point on the x axis represents a date, but I only want to show the day number, and have the x axis title display the month - so as the user pans through the days from 1 to 31 it would show January, then as they pan into days 1 - 28, it would show February - and so on.
First, is it possible, and if so, how?
Thanks.
Yes, you can do that using the plotpan event. Do something like this:
$('#placeholder').bind("plotpan", function (event, plot) {
var xAxis = plot.getAxes().xaxis;
// build this function depending on the format of your a values (timestamp ...)
var monthName = getMonthNameFromMaxValue(xAxis.max);
// this depends on the plugin you use for your axis labels (see the link below)
setAxisLabel(monthName);
});
Axis label in Flot
Related
I have written code for customizing my x ticks, snippet of the same is below
arr_label = ['sum_msg_len','log_count','info_hit','debug_hit','error_hit']
for label in arr_label :
fig = plt.figure(figsize=(15,6))
axes = fig.add_axes([1,1,1,1])
axes.xaxis.set_major_locator(plt.LinearLocator(30))
axes.tick_params(axis ='x',labelsize=6)
axes.plot(df.index,df[label],'g',label =label)
axes.legend()
fig.autofmt_xdate()
fig.savefig('images_indv/'+app_index+"_"+label+".png",bbox_inches='tight')
#fig.close()
fig.clf()
my requirement is that is have timestamps spaced by minute and i want to plot timestamp vs ('sum_msg_len'/'log_count'/'info_hit'/'debug_hit'/'error_hit') one by one,
but problem is X ticks, i want some specified no of ticks to appear within the range of the data which i am plotting.
Earlier when i was not specifing any Locator then all the timestamps got overlapped and one cannot read the timestamps properly. So when i try to use a locator, it labels the x-axis with out any relation to the plotted value.
Like if i use LinearLocator(30) it just plots the first 00 to 29 mins in the graph,and if i use LinearLocator(50) it just plots the first 00 to 49 mins in the graph with no change to the y axis values. Plots of both I am putting below. I also tried with different locators Like MultipleLocator and MaxNlocator, but issue sustains
In short, I just want the graph plotted for 21July 00:00:00 to 22 July 00:00:00 which will be 1440 entries but the i want to see around 30-40 intermediate entries mentioned on the plot.
I am trying to create a graph where:
X1 5 10 15 20
X2 10 20 25 30
Y 0 1 1 0
X1 is a minimum value of something, X2 the maximum, and Y the binary outcome--was my event true or not. In my head I picture it as a scatter plot where the horizontal axis is my min, the vertical my max, and there is a color coded dot that shows whether the event is true or not. I can't seem to create this.
I am not aware of a way to do this directly in Excel. As a workaround, you could sort your data by column Y. Then make a scatter plot of the the data where Y=0. Then you manually add the data where Y=1 as a second "series", i.e. right click the chart and click on Select Data, then on Add (Excel 2007).
I'm looking for a way to show where is a point of return of investment is happening thru out the year. So, I want to have a chart of bars where each bar is the income of a certain month (Jan-Dec) and all previous months (shows total profit up until this month), and all of this is shown in reference to a number that represent the investment amount.
for example:
Jan - $100
Feb- $200
March - $300
..
..
Dec - $1200
Investment is $600.
So the chart will show all 12 bars:
- where Jan-Feb will be below the X axis (which is $600), each in different height of course.
- March - will be exactly on the X axis line, because Jan-Feb-March sums up to $600. - this is where I return my investment.
- Apr-Dec will be above the line (which is $600), each in different height of course... where Dec shows $7800 (100+200+300...+1200)
I hope I managed to explain myself.
Basically - an ROI or PB chart :)
Thanks.
You could use a combination column and line chart.
I ended up creating a column that contains cumulative sums of each month, and than created a bar chart of those values. since some of them were below zero and sum were above, that created want I was looking for, except that the x axis was zero and not the investment amount.
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 have a set of points as time of day like
05:36:37
06:31:41
06:38:24
06:39:42
07:03:47
07:04:18
07:09:28
07:28:40
07:29:20
07:29:49
07:31:57
.....
Now i would like to plot this for an entire 24 hour range in a day.
Basically x axis is the 24 hour range and i need a point for every above time on the y axis. ofcourse y axis may not vary, but i am loooking at finding the coverage as to, in a day, when did the even occur more times. Its the same event. If there are better ways to represent you can also suggest that.
Let's say your data is from A1 to A_N.
in column B enter =HOUR(A1)
in column C enter =MINUTE(A1)
Then Insert -> XY Scatter Chart