11 Less Used but Important Plots for Data Science
import plotly.express as px
df = px.data.iris()
df
import plotly.express as px
df = px.data.iris()
fig = px.parallel_coordinates(df, color="species_id", labels={"species_id": "Species",
"sepal_width": "Sepal Width", "sepal_length": "Sepal Length",
"petal_width": "Petal Width", "petal_length": "Petal Length", },
color_continuous_scale=px.colors.diverging.Tealrose,
color_continuous_midpoint=2)
fig.show()
# import numpy as np
# import seaborn as sns
# sns.set_theme(style="ticks")
# rs = np.random.RandomState(11)
# x = rs.gamma(2, size=1000)
# y = -.5 * x + rs.normal(size=1000)
# sns.jointplot(x=x, y=y, kind="hex", color="#4CB391")
ax = df.plot.hexbin(x='sepal_width', y='sepal_length', gridsize=20,color='#BDE320')
import plotly.express as px
fig = px.density_contour(df, x="sepal_width", y="sepal_length")
fig.update_traces(contours_coloring="fill", contours_showlabels = True)
fig.show()
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
np.random.seed(10)
# Generate Univariate Observations
gauss_data = 5 * np.random.randn(100) + 50
sns.histplot(data=gauss_data, kde=True)
!pip install statsmodels
import statsmodels.api as sm
# q-q plot
sm.qqplot(gauss_data, line='s')
plt.show()
import seaborn as sns
sns.violinplot(data=df, y="sepal_width")
import seaborn as sns
sns.violinplot(data=df,x='species', y="sepal_width")
sns.boxenplot(x=df["sepal_width"])
sns.boxenplot(data=df, x="species",y='sepal_width')
import seaborn as sns
sns.pointplot(data=df,x="species", y="sepal_width")
import seaborn as sns
sns.swarmplot(data=df,x="species", y="sepal_width")
!pip install wordcloud
import pandas as pd
data=pd.read_csv('/work/android-games.csv')
data.head()
data.category.value_counts()
#importing the module from wordcloud library
from wordcloud import WordCloud
import matplotlib.pyplot as plt
#creating a text from the category column by taking only the 2nd part of the category.
text = " ".join(cat.split()[1] for cat in data.category)
#generating the cloud
word_cloud = WordCloud(collocations = False, background_color = 'black').generate(text)
plt.imshow(word_cloud, interpolation='bilinear')
plt.axis("off")
plt.show()
import plotly.express as px
df = px.data.tips()
df.head(5)
fig = px.sunburst(df, path=['sex', 'day', 'time'], values='total_bill', color='time')
fig.show()