graphing

Any examples of Flot with floating tooltips?

感情迁移 提交于 2019-12-02 20:33:39
I am currently working on a Flot graph, the API which seems pretty powerful overall, although examples of advanced use are not widely documented. The API suggests there are ways to set hoverable on the graph, not that I am sure what exactly that means I can do with it. I would like to know if anyone could contribute some examples that they have come across, or code for that matter, which demonstrate examples of any of the following: Dynamic tooltips triggered by hover over events on Flot chart elements Tick tooltips (hovering over the xaxis shows detail) Any kind of hover over / dynamic event

matplotlib set yaxis label size

假装没事ソ 提交于 2019-12-02 18:40:56
How can I change the size of only the yaxis label? Right now, I change the size of all labels using pylab.rc('font', family='serif', size=40) but in my case, I would like to make the y-axis label larger than the x-axis. However, I'd like to leave the tick labels alone. I've tried, for example: pylab.gca().get_ylabel().set_fontsize(60) but I only get: AttributeError: 'str' object has no attribute 'set_fontsize' So, obviously that doesn't work. I've seen lots of stuff for tick sizes, but nothing for the axis labels themselves. bmu If you are using the 'pylab' for interactive plotting you can set

Putting newline in matplotlib label with TeX in Python?

巧了我就是萌 提交于 2019-12-02 17:49:53
How can I add a newline to a plot's label (e.g. xlabel or ylabel) in matplotlib? For example, plt.bar([1, 2], [4, 5]) plt.xlabel("My x label") plt.ylabel(r"My long label with $\Sigma_{C}$ math \n continues here") Ideally I'd like the y-labeled to be centered too. Is there a way to do this? It's important that the label have both TeX (enclosed in '$') and the newline. Your example is exactly how it's done, you use \n . You need to take off the r prefix though so python doesn't treat it as a raw string You can have the best of both worlds: automatic "escaping" of LaTeX commands and newlines: plt

ggplot2 y-axis ticks not showing up on a log scale

家住魔仙堡 提交于 2019-12-02 04:59:26
问题 I am trying to use ggplot2 to create a boxplot graph but I am having trouble getting the ticks to show up as it does in the examples of the ggplot2 webiste. Here is some fake data of tastiness of fruits: apples <- data.frame(fruit=c(rep("apple", 30)), taste=runif(30, 30, 50) banana <- data.frame(fruit=c(rep("banana", 30)), taste=runif(30, 300, 500)) orange <- data.frame(fruit=c(rep("orange", 30)), taste=runif(30, 3000, 5000)) fruits <- rbind(apples,banana,orange) If I plot as in the ggplot2

Trace a 3d graph with a black line where Z = 0?

大憨熊 提交于 2019-12-02 03:29:01
问题 I have a functional 3d graph, but I want to make a trace line on the graph for when z = 0. I tried to split up the graphs for when z>=0 and z<0 but this does not make a clear representation, as shown in code commented out. I want to trace this line in a different color. Another solution would be to have part of the graph z>=0 be one color and z<0 be another color, but I keep getting an error for this as well. from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from

Update Lines in matplotlib

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 03:14:32
问题 I have a graph with multiple data sets on it. I need to continually redraw these lines, each separately, as the data is updated. How can I delete and reestablish it repeatedly, preferably without having to delete the entire graph and redraw all of the lines on it every time? 回答1: #!/usr/bin/env python import time from pylab import * ion() # turn interactive mode on # initial data x = arange(-8, 8, 0.1); y1 = sin(x) y2 = cos(x) # initial plot line1, line2, = plot(x, y1, 'r', x, y2, 'b') line1

Trace a 3d graph with a black line where Z = 0?

半腔热情 提交于 2019-12-02 01:35:07
I have a functional 3d graph, but I want to make a trace line on the graph for when z = 0. I tried to split up the graphs for when z>=0 and z<0 but this does not make a clear representation, as shown in code commented out. I want to trace this line in a different color. Another solution would be to have part of the graph z>=0 be one color and z<0 be another color, but I keep getting an error for this as well. from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np def

JFreeChart Date axis Formatting issue

删除回忆录丶 提交于 2019-12-01 21:22:43
I have a time series chart. I have my x-axis as a Date, and the Y-axis are just numbers. I am trying to format the date on the x-axis, however I keep getting exceptions. My code is below: TimeSeries trueSeries = new TimeSeries("True Data"); TimeSeries regressionSeries = new TimeSeries("Regression Line"); TimeSeries averageSeries = new TimeSeries("Moving Average"); for (Date date : regression.keySet()) { Calendar cal = Calendar.getInstance(); cal.setTime(date); int month = cal.get(Calendar.MONTH) + 1; int day = cal.get(Calendar.DAY_OF_MONTH); int year = cal.get(Calendar.YEAR); regressionSeries

Selective patterns with Matplotlib imshow

99封情书 提交于 2019-12-01 06:34:47
问题 Is there a way to place custom patterns into selected areas on an imshow graph? To be precise, I need to make it so that, in addition to the numerical-data-carrying colored squares, I also have different patterns in other squares indicate different failure modes for the experiment (and also generate a key explaining the meaning of these different patterns). An example of a pattern that would be useful would be various types of crosshatches. i need to be able to do this without disrupting the

Python plotting error bars with different values above and below the point

末鹿安然 提交于 2019-12-01 05:19:00
Warning: I'm very new to using python. I'm trying to graph data using error bars but my data has different values for the error above and below the bar, i.e. 2+.75,2-.32. import numpy as np import matplotlib.pyplot as plt # example data x = (1,2,3,4) y = (1,2,3,4) # example variable error bar values yerr = 0.2 plt.figure() plt.errorbar(x, y, yerr,"r^") plt.show() But I want the error bar above the point to be a specific value like .17 and below the point to be a specific point like .3 Does anyone know how to do this? Thanks! Like this: plt.errorbar(x, y, np.array([[0.3]*len(x), [0.17]*len(x)])