Skip to content

Getting Started

using TidierPlots
using DataFrames

penguins = penguins_data()
333×7 DataFrame
Rowspeciesislandbill_length_mmbill_depth_mmflipper_length_mmbody_mass_gsex
StringStringFloat64Float64Int64Int64String
1AdelieTorgersen39.118.71813750male
2AdelieTorgersen39.517.41863800female
3AdelieTorgersen40.318.01953250female
4AdelieTorgersen36.719.31933450female
5AdelieTorgersen39.320.61903650male
6AdelieTorgersen38.917.81813625female
7AdelieTorgersen39.219.61954675male
8AdelieTorgersen41.117.61823200female
9AdelieTorgersen38.621.21913800male
10AdelieTorgersen34.621.11984400male
11AdelieTorgersen36.617.81853700female
12AdelieTorgersen38.719.01953450female
13AdelieTorgersen42.520.71974500male
14AdelieTorgersen34.418.41843325female
15AdelieTorgersen46.021.51944200male
16AdelieBiscoe37.818.31743400female
17AdelieBiscoe37.718.71803600male
18AdelieBiscoe35.919.21893800female
19AdelieBiscoe38.218.11853950male
20AdelieBiscoe38.817.21803800male
21AdelieBiscoe35.318.91873800female
22AdelieBiscoe40.618.61833550male
23AdelieBiscoe40.517.91873200female
24AdelieBiscoe37.918.61723150female
25AdelieBiscoe40.518.91803950male
26AdelieDream39.516.71783250female
27AdelieDream37.218.11783900male
28AdelieDream39.517.81883300female
29AdelieDream40.918.91843900male
30AdelieDream36.417.01953325female
31AdelieDream39.221.11964150male
32AdelieDream38.820.01903950male
33AdelieDream42.218.51803550female
34AdelieDream37.619.31813300female
35AdelieDream39.819.11844650male
36AdelieDream36.518.01823150female
37AdelieDream40.818.41953900male
38AdelieDream36.018.51863100female
39AdelieDream44.119.71964400male
40AdelieDream37.016.91853000female
41AdelieDream39.618.81904600male
42AdelieDream41.119.01823425male
43AdelieDream36.017.91903450female
44AdelieDream42.321.21914150male
45AdelieBiscoe39.617.71863500female
46AdelieBiscoe40.118.91884300male
47AdelieBiscoe35.017.91903450female
48AdelieBiscoe42.019.52004050male
49AdelieBiscoe34.518.11872900female
50AdelieBiscoe41.418.61913700male
51AdelieBiscoe39.017.51863550female
52AdelieBiscoe40.618.81933800male
53AdelieBiscoe36.516.61812850female
54AdelieBiscoe37.619.11943750male
55AdelieBiscoe35.716.91853150female
56AdelieBiscoe41.321.11954400male
57AdelieBiscoe37.617.01853600female
58AdelieBiscoe41.118.21924050male
59AdelieBiscoe36.417.11842850female
60AdelieBiscoe41.618.01923950male
61AdelieBiscoe35.516.21953350female
62AdelieBiscoe41.119.11884100male
63AdelieTorgersen35.916.61903050female
64AdelieTorgersen41.819.41984450male
65AdelieTorgersen33.519.01903600female
66AdelieTorgersen39.718.41903900male
67AdelieTorgersen39.617.21963550female
68AdelieTorgersen45.818.91974150male
69AdelieTorgersen35.517.51903700female
70AdelieTorgersen42.818.51954250male
71AdelieTorgersen40.916.81913700female
72AdelieTorgersen37.219.41843900male
73AdelieTorgersen36.216.11873550female
74AdelieTorgersen42.119.11954000male
75AdelieTorgersen34.617.21893200female
76AdelieTorgersen42.917.61964700male
77AdelieTorgersen36.718.81873800female
78AdelieTorgersen35.119.41934200male
79AdelieDream37.317.81913350female
80AdelieDream41.320.31943550male
81AdelieDream36.319.51903800male
82AdelieDream36.918.61893500female
83AdelieDream38.319.21893950male
84AdelieDream38.918.81903600female
85AdelieDream35.718.02023550female
86AdelieDream41.118.12054300male
87AdelieDream34.017.11853400female
88AdelieDream39.618.11864450male
89AdelieDream36.217.31873300female
90AdelieDream40.818.92084300male
91AdelieDream38.118.61903700female
92AdelieDream40.318.51964350male
93AdelieDream33.116.11782900female
94AdelieDream43.218.51924100male
95AdelieBiscoe35.017.91923725female
96AdelieBiscoe41.020.02034725male
97AdelieBiscoe37.716.01833075female
98AdelieBiscoe37.820.01904250male
99AdelieBiscoe37.918.61932925female
100AdelieBiscoe39.718.91843550male
101AdelieBiscoe38.617.21993750female
102AdelieBiscoe38.220.01903900male
103AdelieBiscoe38.117.01813175female
104AdelieBiscoe43.219.01974775male
105AdelieBiscoe38.116.51983825female
106AdelieBiscoe45.620.31914600male
107AdelieBiscoe39.717.71933200female
108AdelieBiscoe42.219.51974275male
109AdelieBiscoe39.620.71913900female
110AdelieBiscoe42.718.31964075male
111AdelieTorgersen38.617.01882900female
112AdelieTorgersen37.320.51993775male
113AdelieTorgersen35.717.01893350female
114AdelieTorgersen41.118.61893325male
115AdelieTorgersen36.217.21873150female
116AdelieTorgersen37.719.81983500male
117AdelieTorgersen40.217.01763450female
118AdelieTorgersen41.418.52023875male
119AdelieTorgersen35.215.91863050female
120AdelieTorgersen40.619.01994000male
121AdelieTorgersen38.817.61913275female
122AdelieTorgersen41.518.31954300male
123AdelieTorgersen39.017.11913050female
124AdelieTorgersen44.118.02104000male
125AdelieTorgersen38.517.91903325female
126AdelieTorgersen43.119.21973500male
127AdelieDream36.818.51933500female
128AdelieDream37.518.51994475male
129AdelieDream38.117.61873425female
130AdelieDream41.117.51903900male
131AdelieDream35.617.51913175female
132AdelieDream40.220.12003975male
133AdelieDream37.016.51853400female
134AdelieDream39.717.91934250male
135AdelieDream40.217.11933400female
136AdelieDream40.617.21873475male
137AdelieDream32.115.51883050female
138AdelieDream40.717.01903725male
139AdelieDream37.316.81923000female
140AdelieDream39.018.71853650male
141AdelieDream39.218.61904250male
142AdelieDream36.618.41843475female
143AdelieDream36.017.81953450female
144AdelieDream37.818.11933750male
145AdelieDream36.017.11873700female
146AdelieDream41.518.52014000male
147GentooBiscoe46.113.22114500female
148GentooBiscoe50.016.32305700male
149GentooBiscoe48.714.12104450female
150GentooBiscoe50.015.22185700male
151GentooBiscoe47.614.52155400male
152GentooBiscoe46.513.52104550female
153GentooBiscoe45.414.62114800female
154GentooBiscoe46.715.32195200male
155GentooBiscoe43.313.42094400female
156GentooBiscoe46.815.42155150male
157GentooBiscoe40.913.72144650female
158GentooBiscoe49.016.12165550male
159GentooBiscoe45.513.72144650female
160GentooBiscoe48.414.62135850male
161GentooBiscoe45.814.62104200female
162GentooBiscoe49.315.72175850male
163GentooBiscoe42.013.52104150female
164GentooBiscoe49.215.22216300male
165GentooBiscoe46.214.52094800female
166GentooBiscoe48.715.12225350male
167GentooBiscoe50.214.32185700male
168GentooBiscoe45.114.52155000female
169GentooBiscoe46.514.52134400female
170GentooBiscoe46.315.82155050male
171GentooBiscoe42.913.12155000female
172GentooBiscoe46.115.12155100male
173GentooBiscoe47.815.02155650male
174GentooBiscoe48.214.32104600female
175GentooBiscoe50.015.32205550male
176GentooBiscoe47.315.32225250male
177GentooBiscoe42.814.22094700female
178GentooBiscoe45.114.52075050female
179GentooBiscoe59.617.02306050male
180GentooBiscoe49.114.82205150female
181GentooBiscoe48.416.32205400male
182GentooBiscoe42.613.72134950female
183GentooBiscoe44.417.32195250male
184GentooBiscoe44.013.62084350female
185GentooBiscoe48.715.72085350male
186GentooBiscoe42.713.72083950female
187GentooBiscoe49.616.02255700male
188GentooBiscoe45.313.72104300female
189GentooBiscoe49.615.02164750male
190GentooBiscoe50.515.92225550male
191GentooBiscoe43.613.92174900female
192GentooBiscoe45.513.92104200female
193GentooBiscoe50.515.92255400male
194GentooBiscoe44.913.32135100female
195GentooBiscoe45.215.82155300male
196GentooBiscoe46.614.22104850female
197GentooBiscoe48.514.12205300male
198GentooBiscoe45.114.42104400female
199GentooBiscoe50.115.02255000male
200GentooBiscoe46.514.42174900female
201GentooBiscoe45.015.42205050male
202GentooBiscoe43.813.92084300female
203GentooBiscoe45.515.02205000male
204GentooBiscoe43.214.52084450female
205GentooBiscoe50.415.32245550male
206GentooBiscoe45.313.82084200female
207GentooBiscoe46.214.92215300male
208GentooBiscoe45.713.92144400female
209GentooBiscoe54.315.72315650male
210GentooBiscoe45.814.22194700female
211GentooBiscoe49.816.82305700male
212GentooBiscoe49.516.22295800male
213GentooBiscoe43.514.22204700female
214GentooBiscoe50.715.02235550male
215GentooBiscoe47.715.02164750female
216GentooBiscoe46.415.62215000male
217GentooBiscoe48.215.62215100male
218GentooBiscoe46.514.82175200female
219GentooBiscoe46.415.02164700female
220GentooBiscoe48.616.02305800male
221GentooBiscoe47.514.22094600female
222GentooBiscoe51.116.32206000male
223GentooBiscoe45.213.82154750female
224GentooBiscoe45.216.42235950male
225GentooBiscoe49.114.52124625female
226GentooBiscoe52.515.62215450male
227GentooBiscoe47.414.62124725female
228GentooBiscoe50.015.92245350male
229GentooBiscoe44.913.82124750female
230GentooBiscoe50.817.32285600male
231GentooBiscoe43.414.42184600female
232GentooBiscoe51.314.22185300male
233GentooBiscoe47.514.02124875female
234GentooBiscoe52.117.02305550male
235GentooBiscoe47.515.02184950female
236GentooBiscoe52.217.12285400male
237GentooBiscoe45.514.52124750female
238GentooBiscoe49.516.12245650male
239GentooBiscoe44.514.72144850female
240GentooBiscoe50.815.72265200male
241GentooBiscoe49.415.82164925male
242GentooBiscoe46.914.62224875female
243GentooBiscoe48.414.42034625female
244GentooBiscoe51.116.52255250male
245GentooBiscoe48.515.02194850female
246GentooBiscoe55.917.02285600male
247GentooBiscoe47.215.52154975female
248GentooBiscoe49.115.02285500male
249GentooBiscoe46.816.12155500male
250GentooBiscoe41.714.72104700female
251GentooBiscoe53.415.82195500male
252GentooBiscoe43.314.02084575female
253GentooBiscoe48.115.12095500male
254GentooBiscoe50.515.22165000female
255GentooBiscoe49.815.92295950male
256GentooBiscoe43.515.22134650female
257GentooBiscoe51.516.32305500male
258GentooBiscoe46.214.12174375female
259GentooBiscoe55.116.02305850male
260GentooBiscoe48.816.22226000male
261GentooBiscoe47.213.72144925female
262GentooBiscoe46.814.32154850female
263GentooBiscoe50.415.72225750male
264GentooBiscoe45.214.82125200female
265GentooBiscoe49.916.12135400male
266ChinstrapDream46.517.91923500female
267ChinstrapDream50.019.51963900male
268ChinstrapDream51.319.21933650male
269ChinstrapDream45.418.71883525female
270ChinstrapDream52.719.81973725male
271ChinstrapDream45.217.81983950female
272ChinstrapDream46.118.21783250female
273ChinstrapDream51.318.21973750male
274ChinstrapDream46.018.91954150female
275ChinstrapDream51.319.91983700male
276ChinstrapDream46.617.81933800female
277ChinstrapDream51.720.31943775male
278ChinstrapDream47.017.31853700female
279ChinstrapDream52.018.12014050male
280ChinstrapDream45.917.11903575female
281ChinstrapDream50.519.62014050male
282ChinstrapDream50.320.01973300male
283ChinstrapDream58.017.81813700female
284ChinstrapDream46.418.61903450female
285ChinstrapDream49.218.21954400male
286ChinstrapDream42.417.31813600female
287ChinstrapDream48.517.51913400male
288ChinstrapDream43.216.61872900female
289ChinstrapDream50.619.41933800male
290ChinstrapDream46.717.91953300female
291ChinstrapDream52.019.01974150male
292ChinstrapDream50.518.42003400female
293ChinstrapDream49.519.02003800male
294ChinstrapDream46.417.81913700female
295ChinstrapDream52.820.02054550male
296ChinstrapDream40.916.61873200female
297ChinstrapDream54.220.82014300male
298ChinstrapDream42.516.71873350female
299ChinstrapDream51.018.82034100male
300ChinstrapDream49.718.61953600male
301ChinstrapDream47.516.81993900female
302ChinstrapDream47.618.31953850female
303ChinstrapDream52.020.72104800male
304ChinstrapDream46.916.61922700female
305ChinstrapDream53.519.92054500male
306ChinstrapDream49.019.52103950male
307ChinstrapDream46.217.51873650female
308ChinstrapDream50.919.11963550male
309ChinstrapDream45.517.01963500female
310ChinstrapDream50.917.91963675female
311ChinstrapDream50.818.52014450male
312ChinstrapDream50.117.91903400female
313ChinstrapDream49.019.62124300male
314ChinstrapDream51.518.71873250male
315ChinstrapDream49.817.31983675female
316ChinstrapDream48.116.41993325female
317ChinstrapDream51.419.02013950male
318ChinstrapDream45.717.31933600female
319ChinstrapDream50.719.72034050male
320ChinstrapDream42.517.31873350female
321ChinstrapDream52.218.81973450male
322ChinstrapDream45.216.61913250female
323ChinstrapDream49.319.92034050male
324ChinstrapDream50.218.82023800male
325ChinstrapDream45.619.41943525female
326ChinstrapDream51.919.52063950male
327ChinstrapDream46.816.51893650female
328ChinstrapDream45.717.01953650female
329ChinstrapDream55.819.82074000male
330ChinstrapDream43.518.12023400female
331ChinstrapDream49.618.21933775male
332ChinstrapDream50.819.02104100male
333ChinstrapDream50.218.71983775female

ggplot()¤

ggplot() is the starting point of any plot. It sets up the initial plot with default settings that can be later customized with geoms, scales, theme settings and other specifications. ggplot usually used with a data source as an argument, and optionally, a set of aesthetics specified by @aes(). The data source is typically a DataFrame.

If a set of aesthetics is specified in the initial ggplot call, these aesthetics apply to all layers added to the plot, unless they are overridden in subsequent layers.

ggplot(penguins, @aes(x = bill_length_mm, y = bill_depth_mm, color = species)) +
    geom_point()

@aes()¤

aes() is used to map variables in your data to visual properties (aesthetics) of the plot. These aesthetics can include things like position (x and y coordinates), color, shape, size, etc. Each aesthetic is a way of visualizing a variable or a statistical transformation of a variable.

Aesthetics are specified in the form aes(aesthetic = variable), where aesthetic is the name of the aesthetic, and variable is the column name in your data that you want to map to the aesthetic. The variable names do not need to be preceded by a colon.

Of note, TidierPlots.jl accepts multiple forms for aes specification, none of which is exactly the same as ggplot2.

  • Option 1: @aes macro, aes as in ggplot, e.g. @aes(x = x, y = y)
  • Option 2: @es macro, aes as in ggplot, e.g. @es(x = x, y = y)
  • Option 3: aes function, julia-style columns, e.g. aes(x = :x, y = :y)
  • Option 4: aes function, strings for columns, e.g. aes(x = "x", y = "y")

The examples below will generally use option 1

In the above example, we can see that the x, y, and color aesthetics are being mapped to each subsequent layer of the plot.

In general, aes() can be used within the ggplot to set global aesthetics that apply to all layers, or within individual geoms to set aesthetics that apply only to that layer.

Moving from general rules, to specific plots, let us first explore geom_point()

geom_point() geom_point is used to create a scatter plot. It is typically used with aesthetics mapping variables to x and y positions, and optionally to other aesthetics like color, shape, and size. geom_point can be used to visualize the relationship between two continuous variables, or a continuous and a discrete variable. The following visuals features can be changed within geom_point(), shape, size, stroke, strokecolour, and alpha .

ggplot(penguins, @aes(x = bill_length_mm, y = bill_depth_mm, color = species)) +
    geom_point( size = 20,
                stroke = 1,
                strokecolor = "black",
                alpha = 0.2) +
    labs(x = "Bill Length (mm)", y = "Bill Width (mm)") +
    lims(x = c(40, 60), y = c(15, 20)) +
    theme_minimal()

In the example above, a scatter plot is created with the variable billlengthmm mapped to the x position, and billdepthmm mapped to the y position with color mapped to species. Supported optional arguements include:

  • size - this is the size of the marker
  • alpha (or transparency), is set to a value between 0 and 1.
  • strokecolor is the stroke color around the marker. https://juliagraphics.github.io/Colors.jl/stable/namedcolors/ colors can be chosen from any name on this list
  • stroke this is the thickeness of the stroke around the marker

lims¤

lims allows the user to set the ranges for the x and y axises as shown in the example above.

geom_bar, geom_col, and geom_histogram¤

geom_bar is used to create bar plots for categorical data. geom_col is a special case of geom_bar where the height of the bars is already computed and does not need to be counted. geom_histogram is used to create a histogram, which is essentially a bar plot for continuous data, where the data is divided into bins and the number of data points in each bin is counted.

ggplot(data=penguins, @aes(x=species)) +
  geom_bar(aes(color = "island"), position = "dodge")

geom_bar optional arguments include

  • color, alpha as above
  • position, when set to "dodge," bar charts will not stack
ggplot(data=penguins, @aes(x = island, y=species)) +
    geom_col()

ggplot() +
  geom_histogram(data=penguins, @aes(x = bill_length_mm))

In the first example, a bar plot is created with the variable CategoricalVar mapped to the x position, and the count of each category is represented by the height of the bars.

In the second example, a column plot is created with the variable CategoricalVar mapped to the x position, and ComputedHeight mapped to the y position.

A histogram is created with the continuous variable, billlengthmm, mapped to the x position, and the data is divided into bins, with the count in each bin represented by the height of the bars.

geom_path and geom_line¤

The geom_path and geom_line are used to create line plots. geom_path connects the data points in the order they appear in the data, while geom_line connects the data points in order of the x-values.

x_values = 1:10;
y_values = x_values .^ 2;
df_line = DataFrame(X = x_values, Y = y_values);
ggplot(df_line) +
    geom_line(@aes(x = X, y = Y)) +
    labs(title = "Line Plot Example", x = "X axis", y = "Y axis")+
    theme_dark()

geom_step¤

geom_step creates a step plot, which is similar to a line plot but with a step pattern rather than a direct line from point to point.

ggplot(df_line, @aes(x = X, y = Y)) +
    geom_step() +
    labs(title = "Step Plot Example", x = "X axis", y = "Y axis")+
    theme_minimal()

geom_boxplot¤

geom_boxplot creates a boxplot.

ggplot()+
  geom_boxplot(data=penguins, @aes(x = island, y = bill_length_mm))

In this example, a boxplot is created where different island of penguins are mapped to the x position, and the bill length is mapped to the y position. Finally, the each species will be mapped to a different color

geom_boxplot supported optinal arguements currently include:

  • color - if used within the aes() with a categorical variable it will make each category a different color as shown above. When used outside of the aes() and selected with a color, it will make each boxplot that color.
  • alpha - transaparency as above, used outside of the aes()

geom_violin¤

geom_violin creates a violin plot, which is a combination of a boxplot and a kernel density plot.

ggplot(penguins, @aes(x = species, y = bill_depth_mm)) +
    geom_violin()

In this example, a violin plot is created where different species of penguins are mapped to the x position, and the bill depth is mapped to the y position. geom_violin does not currently support mapping a categorical variable to colors.

geom_tile¤

The geom_tile creates a tile plot, also known as a heatmap.

x_values = repeat(1:5, inner = 5);
y_values = repeat(1:5, outer = 5);
values = x_values .* y_values;
df_tile = DataFrame(X = x_values, Y = y_values, Value = values);

ggplot(df_tile, @aes(x = X, y = Y, z = Value)) +
    geom_tile() +
    labs(title = "Tile Plot Example", x = "X axis", y = "Y axis")

geom_text and geom_label¤

geom_text and geom_label are used to add text and labels to a plot.

Combining plots¤

Similar to the patchwork library in R, plots can be combined horizontally using the + and | operators and vertically with the / operator.

plot = ggplot(df_tile, @aes(x = X, y = Y, z = Value)) +
           geom_tile();

plot | plot

plot / plot

These extend beyond two plots, but must be used in functional form for | and /.

plot + plot + plot

/(plot, plot, plot)

Grids of plots can also be combined using parethesis to delimit grid boundaries.

((plot + plot + plot) | plot) / (plot / plot)

scale_x_continuous, scale_y_continuous¤

scale_x_continuous and scale_y_continuous can apply labels and scales, reverse, or adjust the ticks for the axis.

ggplot(penguins, @aes(x = body_mass_g, y = bill_length_mm)) +
    geom_point() +
    scale_x_continuous(
        name="Mass (g)",
        trans=log10
    ) +
    scale_y_continuous(
        name="Length",
        reversed = true,
        labels=label_number(;suffix="mm")
    )

The trans argument takes as input a function which takes in and outputs numerical values. and labels argument can be a string specification from Format.jl or a function which formats a list of strings. Available label generators are:

  • label_bytes
  • label_currency
  • label_date
  • label_log
  • label_number
  • label_ordinal
  • label_percent
  • label_pvalue
  • label_scientific
  • label_wrap

Each of these will accept keywords arguments to generate a label function compatible with the labels argument.

scale_x_log10, scale_y_log10¤

scale_x_log10 and scale_y_log10 apply a base 10 logarithmic transformation to the x and y axes, respectively.

ggplot(penguins, @aes(x = body_mass_g, y = bill_length_mm)) +
    geom_point() +
    scale_x_log10()

In this example, a scatter plot is created where the body mass of penguins is mapped to the x position and the bill length to the y position. A base 10 logarithmic transformation is then applied to the x-axis.

scale_x_log2, scale_y_log2, scale_x_log, scale_y_log¤

These work similarly to the previous ones, but apply a base 2 or base e logarithmic transformation to the x and y axes, respectively.

scale_x_logit, scale_y_logit¤

scale_x_logit and `scaleylogit apply a logit transformation to the x and y axes, respectively. This transformation is often used when visualizing proportions or probabilities.

scale_x_pseudolog10, scale_y_pseudolog10, scale_x_Symlog10, scale_y_Symlog10¤

These apply different types of logarithmic transformations to the x and y axes. The "pseudo" and "Symlog" transformations are designed to handle zeros and negative values more effectively.

scale_x_reverse, scale_y_reverse¤

scale_x_reverse and scale_y_reverse reverse the direction of the x and y axes, respectively.

ggplot(penguins, @aes(x = body_mass_g, y = bill_length_mm, color = species)) +
   geom_point() +
   scale_y_reverse() +
   theme_minimal()

In this example, a scatter plot is created where the body mass of penguins is mapped to the x position and the bill length to the y position. The direction of the y-axis is then reversed.

scale_x_sqrt, scale_y_sqrt¤

scale_x_sqrt and scale_y_sqrt apply a square root transformation to the x and y axes, respectively.

ggplot(penguins, @aes(x = body_mass_g, y = bill_length_mm, color = species)) +
   geom_point() +
   scale_x_sqrt() +
   theme_minimal()

In this example, a scatter plot is created where the body mass of penguins is mapped to the x position and the bill length to the y position. A square root transformation is then applied to the x-axis

geom_errorbar¤

geom_errorbar creates vertical and error bars .

categories = ["A", "B", "C", "D"];
n = length(categories);

mean_values = rand(n);  # Random mean values for demonstration
errors = rand(n) / 2;   # Random error values for demonstration

LowerBound = mean_values .- errors;
UpperBound = mean_values .+ errors;

df_errorbar = DataFrame(
    Category = categories,
    MeanValue = mean_values,
    LowerBound = LowerBound,
    UpperBound = UpperBound);

ggplot(df_errorbar, @aes(x = Category, y = MeanValue, ymin = LowerBound, ymax = UpperBound)) +
    geom_point() + # to show the mean value
    geom_errorbar() +
    labs(title = "Error Bar Plot Example", x = "Category", y = "Mean Value")

ggsave¤

ggsave saves a GGPlot to the specified location.

plot = ggplot(penguins, @aes(x = body_mass_g, y = bill_length_mm, color = species)) +
           geom_point()

ggsave(plot, "penguin_points.png")

In this example, plot is saved to penguin_points.png. Acceptable filetypes are all those supported by CairoMakie: svg, pdf, and png.


This page was generated using Literate.jl.