Yet another question about matplotlib 3d surfaces… I have code which adds a scatter point to a matplotlib surface graph. The problem that I have is that the point always appears behind the surface, regardless of which angle you view it from. If I cobble an (admittedly ugly) version using 3 short lines to mark the same point, it is
Tag: matplotlib
Show correlation values in pairplot using seaborn in python
I have the below data: and I am doing a pairplot as below: However I would like to display the correlation coefficient among the variables and if possible the skewness and kurtosis of each variable. How do you do that in seaborn? Answer As far as I’m aware, there is no out of the box function to do this, you’ll
Create random shape/contour using matplotlib
I am trying to generate an image of a random contour using python but I couldn’t find an easy way to do it. Here is an example sort of what I want: Initially I tought of doing it using matplotlib and gaussian functions, but I could not even get close to the image I showed. Is there a simple way
How to plot aggregated by date pandas dataframe
I have this dataframe To aggregate payout_value by date I use: How do I plot (bar chart) dates on x-axis and aggregated payout sum on y axis? I tried using df.plot(x=’date’, y=’payout_value’,kind=”bar”) approach, but there is no ‘date’ column in df_daily dataframe, print(list(df_daily)) gives [(‘payout_value’, ‘sum’)] Answer you are almost there, use reset_index and plot your by df_daily
Why is numpy.ravel() required in this code that produces small multiples?
I found some code to generate a set of small multiples and it is working perfectly. The line for ax, data in zip(axes.ravel(), clean_sets): contians .ravel() but I do not understand what this is actually doing or why it is necessary. If I take a look at the docs I find the following: Return a contiguous flattened array. A 1-D
Matplotlib’s FuncAnimation calls init_func more than once
The documentation for matplotlib.animation.FuncAnimation says: init_func : […] This function will be called once before the first frame. But whenever I use FuncAnimation, the init_func is called multiple times. You can see this by adding a print statement to the basic example from Matplotlib’s website: Apart from producing a lovely plot, it immediately gives the standard output: If I keep
Why do my google tiles look poor in a Cartopy map?
I am a bit puzzled by the rendering of google tiles with Cartopy. The map looks extremely poor compared to the standard google map look. Example (code from https://ocefpaf.github.io/python4oceanographers/blog/2015/06/22/osm/): Generates: Which looks very poor—look at the pixelated rendering of text label and street number—compared to the same image shown on the linked website: Changing zoom level does not seem to
Automated cross stich pattern
I’m trying to create a cross stitch pattern with python as shown in the attached image. So far I simply have the pixilated image. I could import it in excel and manually add the grid and colors etc. But how can I ‘easily’ automate this in python? Can I use any of the normal figure plotting functions (pyplot), or should
Pandas.plot Multiple plot same figure
I have multiple CSV files that I am trying to plot in same the figure to have a comparison between them. I already read some information about pandas problem not keeping memory plot and creating the new one every time. People were talking about using an ax var, but I do not understand it… For now I have: But it’s
Draggable lines select one another in Matplotlib
I’m trying to create a class of draggable lines using matplotlib handling and picking. The aim is to set different thresholds and intervals on a graph. Here is the code: The behavior is what I expected when using only 1 line (even if it notify the selection also when I release the line). When I’m using more than one line