[Solved] How to rotate xticklabels in a seaborn catplot

The correct way to set the xticklabels for sns.catplot, according to the documentation, is with the .set_xticklabels method (.e.g. g.set_xticklabels(rotation=30)). Using a loop to iterate through the Axes, should be used if changes need to be made on a plot by plot basis, within the FacetGrid. Building structured multi-plot grids seaborn.FacetGrid g or in the … Read more

[Solved] How to draw a histogram from existing bin values

Since you already have binned data, just use pyplot.errorbar or add yerr kwarg to bar plot from matplotlib import pyplot as plt plt.errorbar( [n/len(bins) for n, x in enumerate(bins)], [x[0][0] for x in bins], yerr = [x[0][1]**0.5 for x in bins], marker=”_”, fmt=”.”) plt.bar( [n/len(bins) for n, x in enumerate(bins)], [x[0][0] for x in bins], … Read more

[Solved] Matplotlib graph adjusment with big dataset [closed]

Given this dataframe: df.head() complete mid_c mid_h mid_l mid_o time 0 True 0.80936 0.80943 0.80936 0.80943 2018-01-31 09:54:10+00:00 1 True 0.80942 0.80942 0.80937 0.80937 2018-01-31 09:54:20+00:00 2 True 0.80946 0.80946 0.80946 0.80946 2018-01-31 09:54:25+00:00 3 True 0.80942 0.80942 0.80940 0.80940 2018-01-31 09:54:30+00:00 4 True 0.80944 0.80944 0.80944 0.80944 2018-01-31 09:54:35+00:00 Create a 50 moving average: … Read more

[Solved] Python – ” AttributeError: ‘str’ object has no attribute ‘Tc’ (Tc is one of the arguments) [closed]

It’s here: def preos(molecule, T, P, plotcubic=True, printresults=True): Tr = T / molecule.Tc # reduced temperature … preos(“methane”, 160, 10, “true”, “true”) You’re clearly passing “methane” into the preos function as a string, then trying to call .Tc on that string. The error is saying exactly that. This doesn’t have anything to do with IPython. … Read more

[Solved] Issue with pip install

Step 1: Find the version of Python that you are using (Is it 2.7 or 3.5 or any other?) Step 2: Click on this link and find ‘Matplotlib’. http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip Download the .whl according to the version of python you are using.Here, I have shown for version 2.7 Step 3: Copy the .whl and place it … Read more

[Solved] How do I plot an 3D graph using x,y and z axis?

import csv from pandas import read_csv filename=”Left.csv” data = read_csv(filename) print(data.shape) #renaming existing columns data.rename(columns={‘epoc (ms)’: ‘epoc’, ‘timestamp (-04:00)’: ‘timestamp’, ‘elapsed (s)’: ‘elapsed’ , ‘x-axis (g)’: ‘xaxis’, ‘y-axis (g)’ : ‘yaxis’ , ‘z-axis (g)’ : ‘zaxis’}, inplace=True) from matplotlib import pyplot data.hist() data.plot(kind=’density’, subplots=True, layout=(3,3), sharex=False) from pandas.plotting import scatter_matrix scatter_matrix(data) pyplot.show() X = dataset[: … Read more

[Solved] Matplotlib spacing in xaxis

Is this what you want?, try adding the below lines of code to your code: plt.xticks(rotation=90) plt.gca().margins(x=0) plt.gcf().canvas.draw() tl = plt.gca().get_xticklabels() maxsize = max([t.get_window_extent().width for t in tl]) m = 0.2 # inch margin s = maxsize/plt.gcf().dpi*150+2*m margin = m/plt.gcf().get_size_inches()[0] plt.gcf().subplots_adjust(left=margin, right=1.-margin) plt.gcf().set_size_inches(s, plt.gcf().get_size_inches()[1]) 4 solved Matplotlib spacing in xaxis