Basic Charts
Here we'll talk about how to plot some basic chart types in DEX using dx
.
Setup
We will be using our own built-in DataFrame generation function for these visualizations. The values you see may be different if you run the same code in a cell, but the column structure should be very similar (if not identical).
The Customized examples with more options do not necessarily represent "good" data visualization; they are just a glimpse into what settings are available to compare against the Simple examples.
Bar
Simple
Make sure you enable dx
as a pandas plotting backend first.

Customized
dx.bar(
df,
x='keyword_column',
y='integer_column',
y2='float_column',
y2_style='dot',
horizontal=True,
bar_width='index',
group_other=True,
column_sort_order="desc",
column_sort_type="string",
pro_bar_mode="combined",
combination_mode="max",
show_bar_labels=True,
)

Make sure you enable dx
as a pandas plotting backend first.
df.plot.bar(
x='keyword_column',
y='integer_column',
y2='float_column',
y2_style='dot',
horizontal=True,
bar_width='index',
group_other=True,
column_sort_order="desc",
column_sort_type="string",
pro_bar_mode="combined",
combination_mode="max",
show_bar_labels=True,
)

Chart Name
Coming soon!
Line
Simple
Make sure you enable dx
as a pandas plotting backend first.

Customized
You may need to use a larger dataset to see the changes here. For these examples, we used dx.random_dataframe(5000)
.
dx.line(
df,
x='datetime_column',
y='integer_column',
line_type="cumulative",
split_by="keyword_column",
multi_axis=True,
smoothing="hourly",
use_count=True,
bounding_type="relative",
zero_baseline=True,
combination_mode="min",
)

Make sure you enable dx
as a pandas plotting backend first.
df.plot.line(
x='datetime_column',
y='integer_column',
line_type="cumulative",
split_by="keyword_column",
multi_axis=True,
smoothing="hourly",
use_count=True,
bounding_type="relative",
zero_baseline=True,
combination_mode="min",
)

Pie
Simple
Customized
dx.pie(
df,
y='index',
split_slices_by='keyword_column',
show_total=False,
pie_label_type='annotation',
pie_label_contents='percent',
)

Make sure you enable dx
as a pandas plotting backend first.
df.plot.pie(
y='index',
split_slices_by='keyword_column',
show_total=False,
pie_label_type='annotation',
pie_label_contents='percent',
)

Scatter
Simple
Make sure you enable dx
as a pandas plotting backend first.
Known Issue
df.plot.scatter()
can be used unless size
is specified. If you wish to use pandas syntax and provide a size
argument, please use df.plot(kind='scatter', ...)
.

Customized
dx.scatter(
df,
x='float_column',
y='integer_column',
size='index',
trend_line='polynomial',
marginal_graphics='histogram',
formula_display='r2'
)

Make sure you enable dx
as a pandas plotting backend first.
Known Issue
df.plot.scatter()
can be used unless size
is specified. If you wish to use pandas syntax and provide a size
argument, please use df.plot(kind='scatter', ...)
.
df.plot(
kind='scatter',
x='float_column',
y='integer_column',
size='index',
trend_line='polynomial',
marginal_graphics='histogram',
formula_display='r2'
)

Tilemap
Since dx.random_dataframe()
returns integer_column
values (-100
to 100
) and float_column
values (0.0
to 1.0
) as the only numeric columns by default, we can suggest enabling the lat_float_column
and lon_float_column
arguments for some quick testing:
More about how Noteable builds with Mapbox here. 🗺️
Simple
Make sure you enable dx
as a pandas plotting backend first.
df.plot.tilemap()
directly
Customized
dx.tilemap(
df,
lat='lat_float_column',
lon='lon_float_column',
icon_opacity=0.5,
icon_size='index',
icon_size_scale="log",
stroke_color="magenta",
stroke_width=5,
label_column='bytes_column',
tile_layer="light",
hover_cols=['keyword_column', 'datetime_column'],
)

Make sure you enable dx
as a pandas plotting backend first.
df.plot(
kind='tilemap',
lat='lat_float_column',
lon='lon_float_column',
icon_opacity=0.5,
icon_size='index',
icon_size_scale="log",
stroke_color="magenta",
stroke_width=5,
label_column='bytes_column',
tile_layer="light",
hover_cols=['keyword_column', 'datetime_column'],
)
df.plot.tilemap()
directly
Violin
Simple
Make sure you enable dx
as a pandas plotting backend first.
df.plot.violin()
directly
Customized
dx.violin(
df,
split_by='keyword_column',
metric='integer_column',
bins=5,
show_interquartile_range=True,
column_sort_order='desc',
)

Make sure you enable dx
as a pandas plotting backend first.
df.plot(
kind='violin',
split_by='keyword_column',
metric='integer_column',
bins=5,
show_interquartile_range=True,
column_sort_order='desc',
)
df.plot.violin()
directly
Wordcloud
Simple
Make sure you enable dx
as a pandas plotting backend first.
df.plot.wordcloud()
directly
Customized
dx.wordcloud(
df,
word_column='dtype_column',
size='float_column',
text_format='token',
word_rotation='45',
random_coloring=True,
)

Make sure you enable dx
as a pandas plotting backend first.
df.plot(
kind='wordcloud',
word_column='keyword_column',
word_column='dtype_column',
size='float_column',
text_format='token',
word_rotation='45',
random_coloring=True,
)
df.plot.wordcloud()
directly