15.
003 Software Tools — Data Science Afshine Amidi & Shervine Amidi
Conversion Guide between R and Python: Advanced features
Data visualization r Additional elements – We can add objects on the plot with the following commands:
Type R Command Python Command
Afshine Amidi and Shervine Amidi
geom_vline( [Link](
August 21, 2020 x, ymin, ymax, color,
xintercept, linetype
linewidth, linestyle
) )
General structure Line
r Basic plots – The main basic plots are summarized in the table below:
geom_hline( [Link](
Type R Command Python Command y, xmin, xmax, color,
yintercept, linetype
linewidth, linestyle
geom_point( [Link]( ) )
Scatter
x, y, params x, y, params
plot
) )
geom_rect( [Link](
Rectangle xmin, xmax, ymin, ymax xmin, xmax, ymin, ymax
geom_line( [Link](
Line ) )
x, y, params x, y, params
plot
) )
geom_text( [Link](
Text x, y, label, hjust, vjust x, y, s, color
geom_bar( [Link](
Bar ) )
x, y, params x, y, params
chart
) )
Box geom_boxplot( [Link](
plot x, y, params x, y, params
) )
geom_tile( [Link](
Heatmap x, y, params x, y, params
) )
where the meaning of parameters are summarized in the table below:
Command Description Use case
color / hue Color of a line / point / border ’red’
fill Color of an area ’red’
size Size of a line / point 4
linetype Shape of a line ’dashed’
alpha Transparency, between 0 and 1 0.3
Massachusetts Institute of Technology 1 [Link]