data-visualization

Use different bar color in seaborn barplot

Use different bar color in seaborn barplot Question: I am trying to choose a specific color for each bar in the following bar plot: Given we have the following pandas Series with variable win_corr: fruity -0.380938 hard -0.310382 pluribus -0.247448 nougat 0.199375 caramel 0.213416 crispedricewafer 0.324680 peanutyalmondy 0.406192 bar 0.429929 chocolate 0.636517 Name: winpercent, dtype: …

Total answers: 1

AttributeError: 'float' object has no attribute 'find'

AttributeError: 'float' object has no attribute 'find' Question: i want to find degree holders. The following code is causing AttributeError: ‘float’ object has no attribute ‘find’ and I do not how to fix it: edu = Edu_data # Function to identify degree def degree(x): #if x.find(‘Bachelor’) != -1 or x.find("Bachelor’s") != -1 or x.find(‘BS’) != …

Total answers: 2

How to show labels in hours and minutes format on xaxis for all x values

How to show labels in hours and minutes format on xaxis for all x values Question: I have a dataframe consisting of datetime column, and values in two columns. df.to_dict() is given at the end of this question. I’d like to plot the line plots for two columns. And I’d like to show all hour …

Total answers: 1

How do I make Order Book Depth Chart in Matplotlib?

How do I make Order Book Depth Chart in Matplotlib? Question: I am trying to create a "Depth Chart" from the Order book which will look like the below: I figured out that histogram will be used but unable to set the proper bins hence producing an improper chart. ‘ASK/QTY’ are given below: [49579.41, 49580.66, …

Total answers: 2

Plotly: Range slider not being displayed for row count > 500

Plotly: Range slider not being displayed for row count > 500 Question: As is visible from the image, the scaffolding for the rangeslider is generated but the trace inside it is not. It is also fully functional otherwise. With some experiment, I found that only if you set the no. of rows to 500 or …

Total answers: 3

Plotly: iplot is not working with df.iplot(). How can i make it work?

Plotly: iplot is not working with df.iplot(). How can i make it work? Question: enter code here import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn import decomposition from sklearn import datasets import seaborn as sns %matplotlib inline import plotly as py import plotly.tools as tls py.offline.init_notebook_mode(connected=True) from plotly.offline import …

Total answers: 2

seaborn is not plotting within defined subplots

seaborn is not plotting within defined subplots Question: I am trying to plot two displots side by side with this code fig,(ax1,ax2) = plt.subplots(1,2) sns.displot(x =X_train[‘Age’], hue=y_train, ax=ax1) sns.displot(x =X_train[‘Fare’], hue=y_train, ax=ax2) It returns the following result (two empty subplots followed by one displot each on two lines)- If I try the same code with …

Total answers: 1

How to get markers with no fill, from seaborn 0.11+

How to get markers with no fill, from seaborn 0.11+ Question: matplotlib.pyplot.scatter() has a facecolors=None argument that will give datapoints the appearance of being hollow on the inside. How to get the same look for seaborn.jointplot()? The same argument was found in previous versions of seaborn but was removed for some reason in the latest …

Total answers: 2

How to remove or hide y-axis ticklabels from a matplotlib / seaborn plot

How to remove or hide y-axis ticklabels from a matplotlib / seaborn plot Question: I made a plot that looks like this I want to turn off the ticklabels along the y axis. And to do that I am using plt.tick_params(labelleft=False, left=False) And now the plot looks like this. Even though the labels are turned …

Total answers: 1