Fix for pyqtgraph bug when ignoring dpi display setting and using 96 dpi - python-3.8

I have the same issue as described in link below, where the axes of my plot aren't rendered correctly if I set the Qt.AA_Use96Dpi attribute of my QApplication to make my application invariant across different display settings.
How to stop display resolution from affecting axes in pyqtgraph plots
The solutions proposed solve the issue of broken axes if Qt.AA_Use96Dpi is not used, but wondering if there is fix that works with it enabled.

Related

OpenCV is not graying an image with cv2.cvtColor when displayed with matplotlib

I tried to gray an image but it does not work properly like it should. It just applied a kind of filter as you can see by using cv2.COLOR_BGR2GRAY function. Kindly someone help me to get over with this issue.
Your issue is that you're using matplotlib to show your grayscale image. Matplotlib applies a colormap. By default that's a colorful one.
Add cmap="gray" in your imshow call: plt.imshow(img_gray, cmap="gray")

Mpld3: blurry image

I created a matplotlib figure (matplotlib on server) and displaying it with mpld3.draw_figure (nodejs on client) only gives blurry images, similar to the ones here:
How to 'turn off' blurry effect of imshow() in matplotlib?
mpld3.draw_figure(`chartBox-${round}`,chart,false,true)
Interpolation setting 'nearest', 'none', did not change anything:
plt.imshow(G,interpolation='nearest')
I assume its some interpolation problem... maybe also there is a 0.5 shift, so that gridpoints 1 -> 1.5 and are then interpolated.
First switching back to matplotlib 1.5.1 and then
mpl.use('Agg')
solved it
see here:
Generating a PNG with matplotlib when DISPLAY is undefined

I am unable to increase the size of the plot(graph)

I'm using matplotlib in spyder. Size of plot is not good enough. I can only see it in the console on the bottom right. Is there any way to make it large?
Spyder images are supposed to be adjustable based on your setup. You can do this manually through the gui. I am guessing that you are not setting your figure size which is one way to increase the size of your figure.
fig = plt.figure(figsize=(16,16)) #Larger the numbers, the larger the figure
Another thing to consider when saving your figure. Use a vectorized format like a pdf and set your dpi so that you can zoom without degrading quality. This will make the file larger of course but it helps make publication quality figures.

Removing background on a 3d plot Julia

I am having some real trouble trying to plot nice things with Julia.
I first used PyPlot which I was happy with but I had to be able to change the angle on a 3D plots (in that case using surface) so I now use Plots directly with the camera speficication. I would like to remove the background on a 3D plot.
using PyPlot, the following command :
ax=gca(); ax:set_axis_off
works fine.
When using Plots, I tried the following :
using Plots; pyplot(grid=false)
and then my code for the surface, and it does not change the output.
I also tried the first example on this page :https://github.com/JuliaPlots/Plots.jl/pull/695 and grid specification does not work (grids are the same on every area of the layout).
I tried after updating every package and it still does not work.
Does anyone have an idea about what would the problem be please?
Thank you in advance !

Plots Frame (including axes) blackened in Qtconsole

When I launch qtconsole with the --colors=linux option and plot something the frame of the plot is blackened so I cannot see the axes because the qtconsole background is also black.
I used to launch this before without problem but have this problem after a recent update of pandas. I am not sure about what changed but I thought there might be a setting I can change to fix this anyway without worrying about what the update modified that broke this.
It looks like the axes are set to transparent by default (this was not happening before).
The following plots as desired, showing the white axes on black background:
import pandas as pd
import matplotlib.pylab as plt
fig = plt.figure()
fig.patch.set_alpha(1)
temp = pd.Series(range(100))
temp.plot()
I would also like to set this behavior as the default one. I have not been able to do that yet. This seemed like a good lead,
http://matplotlib.org/users/customizing.html
but I could not find an option for exactly that yet.
Any suggestion is welcome. Thank you.