Is there a way to show the x-delta and y-delta interactively on a matplotlib plot? The plot would start measuring the delta after the plot is clicked and update based on the hover location of the mouse while showing the readout somewhere on the plot. Does this feature exist?
Related
I have a plot that has a scatter. I was using previous answers that allowed me to click individual points of the scatter and display a label that I connected to each point (Found here and here). It worked well, but I now want to display a separate line on the same plot. I'm able to show the line, but now when I click on points near it, it displays a box about the line and not the scatter. I used zorder to have the scatter displayed on top but that doesn't change anything about which plot is selected when I click. Is there a way to specify which plot is on top in the mplcursors? I would think there would be a way if I wasn't using the loop to connect the scatter plot points with the labels, but I'm not sure if there's another way to do that. Alternatively, is there a way I could tell mplcursors to just ignore the line altogether?
Code snippet:
fig = plt.figure(figsize=(7,4))
ax = fig.add_subplot(1,1,1)
ax.plot(x_axis_2, y_axis_2, zorder=0) #This is the line
for i in self.full_dict['full_results']: #This is for the scatter plot
ax.scatter(i[1],i[2],label='$[1D,2D]: {}$'.format(i[0]),zorder=5)
canvas = FigureCanvasTkAgg(fig, master=self.root)
canvas.draw()
canvas.get_tk_widget().grid(row=14,column=0,ipadx=40,ipady=10,columnspan=6)
datacursor(formatter='{label}'.format)
I'm using matplotlib to show a plot with %matplotlib widget in jupyter lab. Almost every time I show the plot, next thing I have to do is zoom in and examine one of the sections of the plot. I would like to be able to show the plot zoomed into that section, and if I want to examine the rest of the plot, as I sometimes do, I would press back button and see all of it.
This is similar to showing subplot with relevant data or using plt.xlim, except I would like to do it in a single plot so the data I'm looking at can occupy more screen space, and plt.xlim just shows relevant stretch of data without possibility to zoom out again.
How do I do this is jupyter lab?
I have figure with 2 subplots: a candlestick stock chart and the volume bar chart associated below. I would like to hover on both charts when I move my cursor on one of them.
At the moment, the hover is only active on the subplot where the cursor is like in the screenshot
I would like to activate the hover on volumes at the same time
I think it's possible to do it with Java, but I am not sure Python
I am plotting a distribution of variables that are outputs from two different versions of a program. They look very similar (this is great because they should!) and I am showing their ratio in the same figure but on a different axis. My goal is to show the ratio as a scatter plot but with a horizontal line at y=1.0 to show 100% agreement. The issue I am having is even if I plot the line first and then the scatter, my scatter points still show underneath the line plot. (Please see the image linked below.) You can see the scatter in black underneath the line plot in red, even though I call the plot function first. Any recommendations? Thank you!
Distribution of two variables with ratio plot underneath
Is there a way to enlarge the axis-scale label in matplotlib (circled in red in the enlarged plot below)?
I've used ax.tick_params() to successfully edit the tick labels, but I haven't been able to find anything about this specific piece of the plot.
Worse comes to worst, I could go with a manual text() insertion, but I'd like something more direct if possible.
Add a line like this
ax.xaxis.get_children()[1].set_size(15)
To change your major tick scale label (I guess we can call it so) to 15 points, if you plot the plot on ax.
If you plot using the pyplot API, add a line of ax=plt.gca() as well.