I am creating plots on which I need to place small bitmaps at a given
location with a given size (ships, navigational markers, and some
results of my analysis). I was unable to force imshow() dropping my
bitmap in the right place, and the examples with add_patch() do not
show anything like I need. Can it be done what I need? If so, how?
Thank you
Related
i want to create a plot with 13 different arrow styles for a vector field showing the stream of a sea. I want to use very specific arrows which are not bult in FancyArrowPatch. Is ther a possibility to use a selfmade design as arrow in python ? Is it possible to somehow add custom arrow styles to the FancyArrowPatch function ?
I have attached the image I want to reproduce with Python (taken from bsh.de/DE/DATEN/Stroemungen/stroemungen_node.html):
My best try was to produce this one:
Which is not quite satisfying yet. I would like to have the same arrows as seen in the first image. If you have suggestions how to make the image fancier I am open for that too.
When I use Matplotlib's plt.show() I get a nice Plot which can can be zoomed to very high precision(practically infinite). But when I save it as a image it loses all this information gives information depending on resolution.
Is there any way I can save the plot with the entire information? i.e Like those interactive plots which can rescaled at any time?
P.S- I know I can set dpi to get high quality images. This is not what I want. I want image similar to Plot which python shows when I run the program. What format is that? Or is it just very high resolution image?
Note- I am plotting .csv files which includes data varying from 10^(-10) to 100's. Thus when I save the plot as .png file I lose all the information/kinks of graph at verŠ½ small scales and only retain features from 1-100.
Maybe the interactive graphic library bokeh is an option for you. See here. It's API is just little different from what you know from matplotlib.
Bokeh creates plots as html files that you can view in your browser. For each graphic you can select wheel zoom to zoom interactively into your graphic. You can change interactively the range that you want to be plotted. Therefore you don't loose information in your graphic.
I have a plotting routine and I show the result with
plt.show()
as this is the easiest way for me to see my data. Once I have found and area which I want to look at i want to plot the exact same area again for a different set of data which has the same xy dimensions. The easies way for me would be to see the coordinates of the corners after the zoom or the origin of the zoom and the size in xy direction.
I found this solution . If I understand it correctly I have to manually change the plotting script with the new x y limits for each subsequent plot I want to make.
Is there a possibility to show the limit of the manual zoom in the panel itself and have the possibility to perform and actual input in dedicated fields such that I can recreate this zoom?
Do you mean something like this?
This "Figure options" dialog is present in the Qt backend. To use it,
import matplotlib
matplotlib.use("Qt4Agg") # or "Qt5Agg" depending on the version
I have built a GUI with matplotlib and it contains several plots of values versus time. Now I need a special plot which just shows if a value is on or off (binary state).
Kinda like a control lamp on an analog control panel. I have 5 of those on/off values and I dont know how to do it the best way.
The "lamps" must be updateable because I stream the data from serial and analyze it in real time in my GUI.
I attached a picture where you see my current GUI. In the bottom right corner is now a bar chart, I tried to visualize the ON/OFF state with a bar, but it didn't work well and I wasn't able to animate it.
So yeah, how could I display 5 values with each an ON/OFF state in that area?
Instead of passing via bar charts I would directly plot a number of rectangles and then dynamically change their color.
You can find the documentation for rectangular patches here: http://matplotlib.org/api/patches_api.html#matplotlib.patches.Rectangle
If you need some pointers on how to animate such a patch have a look here:
https://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html
In various cases whenever I use latex in matplotlib, I am getting a very pixely appearance when rendering the figure to an image. When I view the figure in interactive mode it looks fine. For example, I'm setting the yaxis label with:
'Emissions Flux '+r'($\mathregular{(\mu g/m^2 s)}$'
I'm also setting the twin y axis to a log scale and the eponents are presumably latex as well. Non latex text is crisp.
I as far I understand the problem your images are too pixelated. Often this is the result of saving an image using a bitmap format. To receive better images one should export them to vector-graphs, like for example pdf.
To export images as vector-graphs your save statement should be something like:
myfig.savefig('myfig.pdf', format='pdf')
A clear explanation about bitmaps and vector graphs: http://www.prepressure.com,
an important source of information concerning matlibplot: http://matplotlib.org