I have a surface plot I've created in python using matplotlib, and I'm trying to fully remove the grid. I've used ax.grid(False) and that removed the grid on the background, but I'm still getting this faint white checkerboard pattern.
I've been doing some research and I can't figure out how to get this to go away. Any tips?
I figured it out. It was as simple as just setting antialiased equal to false.
Related
**Note: My code is at the end of the question.
I want to recreate this chart in matplotlib:
I have come a long way of making something similar but I am stuck in the last part, which is to zoom in the plot to remove all the white space. So basically, I want to zoom in to the red box:
Note that the grid will be removed on the actual chart. Displaying it now to explain what I would like done.
Is that possible? My code is here:
https://github.com/Curbal-Data-Labs/Matplotlib-Labs/blob/master/Polar%20charts/Polar%20bar%20chart.ipynb
I'm using Python, and I have some data which can be projected on to points within an equilateral triangle whose side lengths sum to 1.
I'm not sure if there is an easy way to visualise a plot like this from Matplotlib or similar libraries, or if I'm just going to have to use a drawing package from scratch to make it happen. Any pointers gratefully recieved. Thanks!
If all you want to do is plot a few dots on a graph, you can infact use Matfplotlib's scatter plots for this:
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html
Using plt.xlim(*min*, *max*) and plt.ylim(*min*, *max*), you can set the limits of the graph manually to fit your values (might not be neccessary though).
You can draw lines on the graph for the triangle shape (if you need that): How to draw a line with matplotlib?
If you don't need a scale, you can even remove that to have a blank canvas: Matplotlib plots: removing axis, legends and white spaces
I am plotting a scatterplot on a tkinter canvas and have a basic call such as the following which works great
ax.scatter(_x, _y, _z, marker=_m, c=_c ,s=_s, picker=True, alpha=1)
My questions is, is it possible for a plot point to have two colors, ie instead of a red circle, have a half red/half green circle.
thanks
Matplotlib half black and half white circle
I found the same question here. It is a hard one to find as search words are not common
You would think this is Google-able but I haven't been able to find anything.
pandas' plot function uses matplotlib, so you can use the matplotlib functions set_xlabel and set_ylabel
plot = df.plot(x="Some Data",y="Other Data",kind="hist")
plot.set_xlabel("X")
plot.set_ylabel("Y")
I had likely issue with all labels missing from histogram and found very unusual cause of the problem
I use Dark Reader extension to put all notebooks in dark mode. This extension simply make plot's background black and all lables become invisible, because they are also black. Kind of silly, but I spend some time trying to solve this riddle
I am plotting some scalar data as a contour plot with matplotlib.contourf. On top of it, I am plotting some vector data with matplotlib.arrow. The basic plot has come along OK, but now I need to put a box on the plot with a default-size arrow plus the data value to which it corresponds, so the viewer will know what kind of scale he is looking at. For instance, I need a box with a horizontal arrow of some length and, below that, some text like "10 cm/sec".
First, if anyone can give me a simple approach to this, I would be grateful.
Second, the approach I have tried is to do the contour plot, then plot the arrows, then add a rectangle to the plot like so:
rect=pl.Rectangle((300,70),15,15,fc='white')
pl.gca().add_patch(rect)
and then, finally, put my scale arrow and text on top of this rectangle.
This isn't working because the rectangle patch covers up the contour, but it doesn't cover up the arrows in the plot. Is there a way to move the patch completely "to the front" of everything else?
Got it. Using pylab.quiver and pylab.quiverkey functions. quiver produces a nice vector field with just a few lines of code, and quiverkey makes it easy to produce a scaling vector with text. And, for some reason, the arrows plotted with quiver are indeed covered by my rectangle, so it is easy to make the scaling arrow very visible. There are still some mysteries in all of this for me. If anyone wants to try to clear them up, would be much obliged. But I have a way now to do what I need in this instance.