I have a pandas dataframe, with columns ‘groupname’, ‘result’, and ‘temperature’. I’ve plotted a Seaborn swarmplot, where x=’groupname’ and y=’result’, which shows the results data separated into the groups. What I also want to do is to colour the markers according to their temperature, using a colormap, so that for example the coldest are blue and hottest red. Plotting the
Tag: matplotlib
Avoid annotations and tick y_tick labels overlapping
I went through several questions but none seem to address the problem of annotations overlapping with y tick labels. I found a nice code that prevents annotations overlapping among themselves, but nothing with tick labels. My problem is quite simple actually. I use the following lines to create the graph I paste just below them. I use annotate to show
Is there a way to visualise time series data in such a way that on x-axis i get ticks in year-month format in python?
I am trying to plot a data of stock close price for each day but on the x-axis, i get no labels on xtick instead of year-month format I tried to take the “Date” and “Close Price” column in a separate dataframe and then tried plotting them. I have dataframe similar to this Answer Just covert it with pandas to_datetime()
Python spectrogram in 3D (like matlab’s spectrogram function)
My question is the following: I have all the values that I need for a spectrogram (scipy.fftpack.fft). I would like to create a 3D spectrogram in python. In MATLAB this is a very simple task, while in python it seems much more complicated. I tried mayavi, 3D plotting matplotlib but I have not managed to do this. Thanks My code:
Matplotlib throws warning message because of findfont – python
I want to plot a basic graph, basically consisting of two lists of the form x = [1,2,3,…,d], y = [y1,y2,…,yd]. after using_ pyplot.plot(x,y) I get a huge amount of warning messages referring to findfont errors (see below..) I just installed matplotlib. All the threads I could find refer to changing fonts manually and having warning messages popping up. I
Mute DEBUG alerts from ‘import pandas’ statement
I’m importing pandas and it continues to throw 7 DEBUG messages. It’s happening in JupyterLab and pythonanywhere. It does not appear when I comment out the pandas import I tried to mute them using: warnings.filterwarnings(“ignore”), to no avail. Tried “from pandas import pandas as pd” to try and avoid any further import, etc. … goes on for 100+ lines further
Why error bars in log-scale matplotlib bar plot are lopsided?
I’m trying to plot some bar plots, where each y-value is averaged over some series. Consequently, I’m also trying to add the error bars (standard deviations) for each bar. The magnitudes generally seem right, even in log scale, but for several of the bars, the error bar drops down (- direction) almost indefinitely, while the + direction error is the
How to combine 2 dataframe histograms in 1 plot?
I would like to use a code that shows all histograms in a dataframe. That will be df.hist(bins=10). However, I would like to add another histograms which shows CDF df_hist=df.hist(cumulative=True,bins=100,density=1,histtype=”step”) I tried separating their matplotlib axes by using fig=plt.figure() and plt.subplot(211). But this df.hist is actually part of pandas function, not matplotlib function. I also tried setting axes and adding
Seaborn Catplot set values over the bars
I plotted a catplot in seaborn like this I am getting an output like shown below I want to add the values of each bar on its top in K representation. For example in 2013 the bar for Michigan is at 48411 so I want to add the value 48.4K on top of that bar. Likewise for all the bars.
Python NetworkX — set node color automatically based on a list of values
I generated a graph with networkx Now I would like to assign a value to each node between 0 and 4 And I would like to assign the color to each node base on the val list and plot something like shown here Answer To set a node property, you can use: Networkx draw calls down to draw_networkx_nodes, this takes