Click on a matplotlib figure and show variables - python

I have a question about matplotlib. I want to be able to click on a cell and show the value of the variable in that cell
In the figure below, I can display the E (x) and N (y) coordinates but I can't display the water level (z).
I tried looking into backends and interactive mode but that isn't really what I need. At the moment I am using matplotlib q5. I am relatively new to python so any advice on how I can click on a figure to show values (kind of like you can in excel) would be great.
thanks!
Emma

Related

Is it possible to display matplotlib plots in columns without using subplots?

I'm creating an HTML report with a lot of plots and corresponding tables. It's quite big, so it would be great if the user could copy/paste the plot title into Find In Page to quickly find the associated table(s).
This answer made me realise that's not possible and that printing the title to the screen would help.
However, I want to display the charts in 2 columns.
Is it possible to print the title, display a plot, print a title to the right, display a plot to the right, begin next column, and so on, without using plt.subplots()?
If not in matplotlib, are there any plotting packages that could do this?

My interactive graphs using bokeh are not interactive

I was making a course on Datacamp about Interactive Graphs with Bokeh. So I tried to do the same in Jupyter Notebook. I put the link of my code here:
https://github.com/Kkkihon/Interactive-Data-Visualizations/blob/d014755354aaaa2a1e382373c519a18c3e1c7d42/Graphs
My problems are:
On the THIRD GRAPH my legend is just "region" but i want to change it to show all the countries of my data list in the column "region"
On the FOURTH GRAPH when I move the Slider the title of the graph should change and also the dots on the graph but it doesn't happen.
On the SIXTH GRAPH my graph should change the values on the axis but my values remains on life vs fertility.
I'm clearly new to using python language and I don't want someone to do everything for me either. I want to understand why I have these problems and correct myself.

Plot Graphs in separated window

I have a long Jupyter notebook code and there is many cells, which are redrawing the actual graph plot. When I am running cells after changing their contents I need to check the plot, but I always need to scroll up and down. I would prefer to watch the plot changes in separated window (I am using two monitors), so I will change the cell content, run the cell, and then just turn my head and see the plot - without any scrolling. Is there a way how to do that? I know it can be done by Spyder, but I want to do it in Jupyter notebook, since I use a lot of notebook advantages, such as Latex notes and headings between cells. Thanks a lot for any advice!
It would be great if you could tell us how you print your graph (what library ?). Ipython provide magic command. For example, if you use matplotlib to plot some figures, just add %matplotlib qt on top of your cell to make the plots appear in a separate window.
See the list of magic command available here.

Adding data to particular data point on plot using mouse click

I have developed subplots in mayavi and I want to add data on a particular point on that graph after clicking on that point. I have used mayavi.mlab.text3d but the text is not present on the data point. How to fix this

Bokeh line graph looping

I’ve been working on bokeh plots and I’m trying to plot a line graph taking values from a database. But the plot kind of traces back to the initial point and I don’t want that. I want a plot which starts at one point and stops at a certain point (and circle back). I’ve tried plotting it on other tools like SQLite browser and Excel and the plot seems ok which means I must be doing something wrong with the bokeh stuff and that the data points itself are not in error.
I’ve attached the images for reference and the line of code doing the line plot. Is there something I’ve missed?
>>> image = fig.line(“x”, “y”, color=color, source=something)
(Assume x and y are integer values and I’ve specified x and y ranges as DataRange1d(bounds=(0,None)))
Bokeh does not "auto-close" lines. You can see this is the case by looking at any number of examples in the docs and repository, but here is one in particular:
http://docs.bokeh.org/en/latest/docs/gallery/stocks.html
Bokeh's .line method will only "close up" if that is what is in the data (i.e., if the last point in the data is a repeat of the first point). I suggest you actually inspect the data values in source.data and I believe you will find this to be the case. Then the question is why is that the case and how to prevent it from doing that, but that is not really a Bokeh question.

Categories