Assume there is a scatter plot with axis between 0 to 2 in both x and y. There are points outside this range which are not necessary to be shown in the plot.
Is there a built in module in matplotlib that can be used to show arrows(or any similar symbol) at the edges of the axes showing that there are points outside the plot range?
There's an annotate method that you can use. Here's a link with examples.
You can also add your own arrows and text objects.
Related
Is it possible to create a figure with a grouped axis AND a RangeTool?
This example demonstrates the RangeTool https://docs.bokeh.org/en/latest/docs/gallery/range_tool.html.
I have a list of tuples factors which I want to use as a grouped axis:
[('2017','Jan'),('2017','Feb')..('2019','Oct')]
In the example, the initial pan on the plot seems to be set by x_range in
p = figure(plot_height=300, plot_width=800, tools="xpan", toolbar_location=None,
x_axis_type="datetime", x_axis_location="above",
background_fill_color="#efefef", x_range=(dates[1500], dates[2500]))
However, to use a grouped x axis, one must use FactorRange ala x_range=FactorRange(*factors). I've tried various forms of indexing of factors with FactorRange and cannot get it to work. Is such a thing possible in Bokeh?
The plot in here demonstrates an example of a grouped axis:
https://docs.bokeh.org/en/latest/docs/gallery/bar_mixed.html
The RangeTool assumes an underlying numeric axis, so there is not a direct way to accomplish this. The only route I could see would be to simulate a categorical axis by using a numerical axis with a fixed ticker and tick labels that correspond to the "categories" you want, and then to plot the bars using the corresponding numerical coordinates.
I'm currently developing a Qt desktop application using the Q3DScatter class. I'm inspecting Qt's 3D Scatter example project and I tried to modify the data item set to plot my own data. The data is plotted except that one axis is not well scaled and my 3D plot looks really messy. I'm looking for a way to adjust this axis. I've tried to change the range and the segment count of the axis, I even tried to set the "AutoAdjustRange" of the axis to true, but nothing seemed to solve the problem.
Would really appreciate some help.
PS: Here's a screen capture of what my 3D scatter graph looks like (the "messy" axis is shown with the red arrow)
I figured this out by creating a CustomFormatter class by subclassing QValue3DAxisFormatter and reimplementing some of its functions (I followed this tutorial). Then I set up my axis formatter to my custom formatter (m_graph->axisZ()->setFormatter(cf);).
Subclassing QValue3DAxisFormatter will not work: it determines where ticks and labels are placed, but not how large the axex actually are.
To do that, you can set the (horizontal) aspect ratio, that is a property of Q3DScatter. The following settings will make the data into a cube volume:
plot->setAspectRatio(1.0);
plot->setHorizontalAspectRatio(1.0);
In v2.0-beta, is there a way to configure the tooltip corresponding to that x-position to show up when hovering anywhere above that point on the axis? for example, the functionality shown here:
https://blockchain.info/charts/market-price
As you trace the line horizontally, you are shown the tooltip corresponding with your distance from the y-axis.
What the tooltip shows in your example is the y value corresponding to the distance from the y-axis (i.e. the x value).
Unless you want to extrapolate between data points (not usually a good idea for data like that shown in your example, since you don't know that its going to follow your extrapolation), this means that you need to have data values for all points where you want to show the tooltip.
With that your question is basically about showing every n x axis labels. https://stackoverflow.com/a/31606933/360067 does this similar for the current stable version of Chart.js. For v2.0-alpha, the option you need to be adjusting is scales.xAxes.labels.template.
I can't figure out why Google Charts draws this simple chart aligned to center and doesn't fill entire white area.
Note: X axis is discrete because it represents weeks.
Do you have any idea what can I do with it?
That is how the charts display when you use a discrete (string) axis. If you want edge-to-edge lines, you need to use a continuous (number, date, datetime, timeofday) axis. See an example of the differences here: http://jsfiddle.net/asgallant/Xfx3h/.
I would like to display multiple colors (and potentially shapes and sizes) of data points in a Google Chart scatter chart. Does anyone have an example of how to do so?
I answered my own question after waiting SECONDS for an answer here :-)
You can indeed have different colors for different data elements. For example:
http://chart.apis.google.com/chart?chs=300x200&cht=s&chd=t:1,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&chm=d,ff0000,0,0,8,0|a,ff8080,0,1,42,0|c,ffff00,0,2,16,0
It's the chm= that does the magic. I was trying to have multiple chm= statements. You need to have just one, but with multiple descriptions separated by vertical bars.
You can only use one dataset in a scatter plot, thus only one color.
http://code.google.com/apis/chart/#scatter_plot
From the API description:
Scatter plots use multiple data sets differently than other chart types. You can only show one data set in a scatter plot.
You could effectively fake a multi-color scatter plot by using a line plot with white lines and colored shape markers at the points you want to display.
Here's another example: twitter charts. I'm hoping to do the same thing. Need to find out how to do the concentric circles.