Skip to content

Instantly share code, notes, and snippets.

Created February 7, 2018 13:42
Show Gist options
  • Save anonymous/c26f305ad53197be93a3cb5f2724fb54 to your computer and use it in GitHub Desktop.
Save anonymous/c26f305ad53197be93a3cb5f2724fb54 to your computer and use it in GitHub Desktop.
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
planets = pd.read_csv("planets.csv", sep=',')
sns.set(style="ticks")
# Initialize the figure with a logarithmic x axis
f, ax = plt.subplots(figsize=(7, 6))
ax.set_xscale("log")
sns.swarmplot(x="pl_pnum", y="st_mass", data=planets,
size=2, color=".3", linewidth=0)
# Tweak the visual presentation
ax.xaxis.grid(True)
ax.set(ylabel="")
sns.despine(trim=True, left=True)
Error--------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "C:/Users/params4/Downloads/test.py", line 13, in <module>
size=2, color=".3", linewidth=0)
File "C:\Program Files (x86)\Python 35-32\lib\site-packages\seaborn\categorical.py", line 2786, in swarmplot
dodge, orient, color, palette)
File "C:\Program Files (x86)\Python 35-32\lib\site-packages\seaborn\categorical.py", line 1203, in __init__
self.establish_variables(x, y, hue, data, orient, order, hue_order)
File "C:\Program Files (x86)\Python 35-32\lib\site-packages\seaborn\categorical.py", line 151, in establish_variables
raise ValueError(err)
ValueError: Could not interpret input 'pl_pnum'
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment