I am currently using python 3.8.3 with matplotlib 3.2.2. I want to automatically set the y-ticklabels of my plot after log transforming them. So I have written a small list comprehension that automatically generates the y-ticks, which I set simultaneously as location and label. If i execute the code seen above, the y-ticklabel list looks like this: Which is as
Tag: matplotlib
Background with range on seaborn based on two columns
I am trying to add to my several line plots a background that shows a range from value x (column “Min”) to value y (column “Max”) for each year. My dataset looks like that: I used the following code: I would like something like this with the range being my “Min” and “Max” by year. Is it possible to do
Select plot linestyle with plotly pandas backend
I want to be able to select the linestyle with the pandas plot method with the plotly backend. Matplotlib: When I use the matplotlib backend in pandas, I can do: which allows me to select the linestyle for each column. The output is: Plotly backend: With plotly I can do How can I select the linestyle of a given line
Does Image.open() distort grayscale PNG images?
Recently, I’ve been trying to load some grayscale images into my Python program using Pillow’s Image.open(). However, I’ve been finding that the image gets distorted, and all the values polarized. This is the image generated by the Mac preview: And, this is the image generated by the Image.open() function: My code is as follows: And, the characteristics of the image
Adding a verticle line using axvline in matplotlib based on datetime data
I am trying to add a vertical line using axvline to a line chart using matplotlib and am running into a recurring error. I have been looking for a solution and read what was suggested here How to draw vertical lines on a given plot in matplotlib but they do not look specifically at using datetime. A solution is discussed
Highlight specific sample in stripplot from pandas dataframe
I have a pandas dataframe as the following (although with more rows and columns): Index LOC1 LOC2 LOC 3 A 0.054 1.2 0.00 B 0.38 3.89 0.027 C 3.07 2.67 1.635 D 7.36 6.2 0.23 I was wondering if it’s possible to highlight stripplot dots that belong to a specific sample. In my dataframe samples are index names (‘A’, ‘B’…).
python, How to get smoother value?
Somehow seaborn draws smoother line than actual data. For example, for x-value 0.18, actual data is like 11 but value on smoother line is about 3. How would I get value 3 for the x-value when given the list of data? The actual data are: Answer You can access the plot data with: out:
make correlation plot on time series data in python
I want to see a correlation on a rolling week basis in time series data. The reason because I want to see how rolling correlation moves each year. To do so, I tried to use pandas.corr(), pandas.rolling_corr() built-in function for getting rolling correlation and tried to make line plot, but I couldn’t correct the correlation line chart. I don’t know
How can I plot a secondary y-axis with seaborn’s barplot?
I’m trying to plot the data (see below). With company_name on the x-axis, status_mission_2_y on the y axis and percentage on the other y_axis. I have tried using the twinx() fucntion but I can’t get it to work. Please can you help? Thanks in advance! company_name percentage status_mission_2_y EER 1 1 Ghot 1 1 Trv 1 1 Sandia 1 1
How to plot a bar-plot with only one bar colored?
name grade chandler A joey B phoebe B monica C ross A rachel B mike C gunther A How to proceed from here if I want to make 8 different report cards (small graph in A4 size paper), and highlight the grade category in which the student belongs? Edit: I want to show gunther in which group he falls in.