Þ¥bonds€¬cell_resultsÞÙ$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2Цqueued¤logs�§running¦output†¤bodyÙ²

Of course, we can also pass the z-coordinates of the data (z) as the third argument to the heatmap function.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø!Ÿ°persist_js_state·has_pluto_hook_features§cell_idÙ$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2¹depends_on_disabled_cells§runtimeÎ̵published_object_keys�¸depends_on_skipped_cells§erroredÂÙ$a5c86153-8430-4336-a82f-c671b2c63eb5Цqueued¤logs�§running¦output†¤bodyÚK

Defining a custom seriestype

We can define a custom seriestype by creating a new struct and defining a recipe for it. Here we define a custom seriestype SemiLogy that plots the y-axis on a logarithmic scale.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø!=.°persist_js_state·has_pluto_hook_features§cell_idÙ$a5c86153-8430-4336-a82f-c671b2c63eb5¹depends_on_disabled_cells§runtimeÎv¸µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$86a17ea2-ce2c-44a5-ad69-b30b280dfb41Цqueued¤logs‘ˆ¤lineÿ£msg’ºsize(f.(x', y)) = (3, 20) ªtext/plain§cell_idÙ$86a17ea2-ce2c-44a5-ad69-b30b280dfb41¦kwargs�¢id´PlutoRunner_d1acb81e¤fileÙP/home/runner/.julia/packages/Pluto/esC4R/src/runner/PlutoRunner/src/io/stdout.jl¥group¦stdout¥level®LogLevel(-555)§running¦output†¤bodyÈÜH ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQûD¡ˆ°persist_js_state·has_pluto_hook_features§cell_idÙ$86a17ea2-ce2c-44a5-ad69-b30b280dfb41¹depends_on_disabled_cells§runtimeÎM}µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54Цqueued¤logs�§running¦output†¤bodyÚ

To run this notebook plots.jl locally, copy and paste the following into your Julia REPL:

using Pkg; Pkg.activate(temp=true); Pkg.add("Pluto")
BASE_URL = "https://raw.githubusercontent.com/tensor4all/T4APlutoExamples/refs/heads/main/pluto_notebooks/"
notebook = "plots.jl"
url = joinpath(BASE_URL, notebook)
using Pluto; Pluto.run(notebook=download(url))
¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø dc°persist_js_state·has_pluto_hook_features§cell_idÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54¹depends_on_disabled_cells§runtimeÎ)µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$b1c45986-eb23-42aa-ba27-8269686ad626Цqueued¤logs�§running¦output†¤bodyÚ(

We can draw multiple functions on a same plot pane using plot! function. The following example demonstrates plotting the sine function $y = \sin(x)$ for $x \in [-\pi, \pi]$.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø Ïî°persist_js_state·has_pluto_hook_features§cell_idÙ$b1c45986-eb23-42aa-ba27-8269686ad626¹depends_on_disabled_cells§runtimeÎ<Ƶpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22Цqueued¤logs�§running¦output†¤bodyÈÜH ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQû«¹°persist_js_state·has_pluto_hook_features§cell_idÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22¹depends_on_disabled_cells§runtimeÎj4ʵpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$679f9791-df49-47f6-b5e0-562737f265b5Цqueued¤logs�§running¦output†¤bodyÚ

Introduction to Plots.jl

This guide provides an introduction to Plots.jl, a powerful and flexible plotting package for Julia. Plots.jl is a widely used Julia package for data visualization.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø ‚í°persist_js_state·has_pluto_hook_features§cell_idÙ$679f9791-df49-47f6-b5e0-562737f265b5¹depends_on_disabled_cells§runtimeÎR¸µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$0ece0753-f329-43e6-9a34-99eeb7345cf4Цqueued¤logs�§running¦output†¤body ¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÙÒQûE*°persist_js_state·has_pluto_hook_features§cell_idÙ$0ece0753-f329-43e6-9a34-99eeb7345cf4¹depends_on_disabled_cells§runtimeÎ ?çêµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3Цqueued¤logs�§running¦output†¤bodyÈ€× ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQúÔæ°persist_js_state·has_pluto_hook_features§cell_idÙ$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3¹depends_on_disabled_cells§runtimeÎM/÷µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$aeab03ea-5947-4088-b60e-d1b32e98d164Цqueued¤logs�§running¦output†¤bodyȉ„ ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQúÂ`ú°persist_js_state·has_pluto_hook_features§cell_idÙ$aeab03ea-5947-4088-b60e-d1b32e98d164¹depends_on_disabled_cells§runtimeÎõ#¿µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$83905cd7-4548-482b-9514-3b9ef2d99e67Цqueued¤logs�§running¦output†¤bodyÙÙ

Additionally, we can provide x-coordinates (x) and y-coordinates (y) as arguments to the plot function to create custom plots.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø ¶°persist_js_state·has_pluto_hook_features§cell_idÙ$83905cd7-4548-482b-9514-3b9ef2d99e67¹depends_on_disabled_cells§runtimeÎ1nµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9e90b55e-863a-4d6f-91d1-84e15ad1edd7Цqueued¤logs�§running¦output†¤bodyÙ´

Instead of specifying seriestype=:scatter, we can use the scatter or scatter! functions directly.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø é:°persist_js_state·has_pluto_hook_features§cell_idÙ$9e90b55e-863a-4d6f-91d1-84e15ad1edd7¹depends_on_disabled_cells§runtimeÎ,`µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$25a968c0-4209-44e5-8e9a-ba580e0fbf4dЦqueued¤logs�§running¦output†¤bodyÙ–

Heatmap

We can use the heatmap function to visualize a function on a two-dimensional domain.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø!À°persist_js_state·has_pluto_hook_features§cell_idÙ$25a968c0-4209-44e5-8e9a-ba580e0fbf4d¹depends_on_disabled_cells§runtimeΧíµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5744c00e-ff55-4cff-b2ed-7079c341175eЦqueued¤logs�§running¦output†¤bodyÈTC ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQú­Úù°persist_js_state·has_pluto_hook_features§cell_idÙ$5744c00e-ff55-4cff-b2ed-7079c341175e¹depends_on_disabled_cells§runtimeÎ}h/µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9eЦqueued¤logs�§running¦output†¤body ¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÙÒQúfª°persist_js_state·has_pluto_hook_features§cell_idÙ$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9e¹depends_on_disabled_cells§runtimeÎJfeüµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7Цqueued¤logs�§running¦output†¤bodyÈ4D ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQû^/'°persist_js_state·has_pluto_hook_features§cell_idÙ$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7¹depends_on_disabled_cells§runtimeÎ�â±µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$fe019b21-c774-49ff-981c-0487f0b07d42Цqueued¤logs�§running¦output†¤bodyÙ~

To plot a given function, we can pass it as an argument to the plot function.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÙÒQø œå°persist_js_state·has_pluto_hook_features§cell_idÙ$fe019b21-c774-49ff-981c-0487f0b07d42¹depends_on_disabled_cells§runtimeÎ µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$e44c2429-fc7c-4609-b27c-4b527a7b8440Цqueued¤logs�§running¦output†¤bodyÈKç ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÙÒQú›Þj°persist_js_state·has_pluto_hook_features§cell_idÙ$e44c2429-fc7c-4609-b27c-4b527a7b8440¹depends_on_disabled_cells§runtimeΈ«µpublished_object_keys�¸depends_on_skipped_cells§errored±cell_dependenciesÞÙ$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2„´precedence_heuristic §cell_idÙ$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$a5c86153-8430-4336-a82f-c671b2c63eb5„´precedence_heuristic §cell_idÙ$a5c86153-8430-4336-a82f-c671b2c63eb5´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$86a17ea2-ce2c-44a5-ad69-b30b280dfb41„´precedence_heuristic §cell_idÙ$86a17ea2-ce2c-44a5-ad69-b30b280dfb41´downstream_cells_map€²upstream_cells_map‹¡:�¤size�§adjoint�©Base.repr�¤Base�¬Base.println�§heatmap�¡+�¡*�¤conj�¥@show�Ù$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54„´precedence_heuristic §cell_idÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$b1c45986-eb23-42aa-ba27-8269686ad626„´precedence_heuristic §cell_idÙ$b1c45986-eb23-42aa-ba27-8269686ad626´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$f1871cd6-8d8c-4e38-920b-c3f145513b22„´precedence_heuristic §cell_idÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22´downstream_cells_map€²upstream_cells_map„¡:�§heatmap�¡+�¡*�Ù$679f9791-df49-47f6-b5e0-562737f265b5„´precedence_heuristic §cell_idÙ$679f9791-df49-47f6-b5e0-562737f265b5´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4„´precedence_heuristic §cell_idÙ$0ece0753-f329-43e6-9a34-99eeb7345cf4´downstream_cells_map„¨semilogy’Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4Ù$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7¬apply_recipe�¨SemiLogy‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4©semilogy!‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4²upstream_cells_map�£Any�£end�§nothing�¥begin�¨semilogy‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4©nextfloat�§@recipe‘Ù$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9e£===�¦Symbol�¥push!�¬AbstractDict�¡+�¨SemiLogy‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4©@userplot�©semilogy!‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4Ù$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3„´precedence_heuristic §cell_idÙ$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3´downstream_cells_map€²upstream_cells_map…¡:�¤plot�¥plot!�¤rand�¨scatter!�Ù$aeab03ea-5947-4088-b60e-d1b32e98d164„´precedence_heuristic §cell_idÙ$aeab03ea-5947-4088-b60e-d1b32e98d164´downstream_cells_map€²upstream_cells_map‡¡:�¡-�¤plot�¥plot!�¢Ï€�£cos�£sin�Ù$83905cd7-4548-482b-9514-3b9ef2d99e67„´precedence_heuristic §cell_idÙ$83905cd7-4548-482b-9514-3b9ef2d99e67´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$9e90b55e-863a-4d6f-91d1-84e15ad1edd7„´precedence_heuristic §cell_idÙ$9e90b55e-863a-4d6f-91d1-84e15ad1edd7´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$25a968c0-4209-44e5-8e9a-ba580e0fbf4d„´precedence_heuristic §cell_idÙ$25a968c0-4209-44e5-8e9a-ba580e0fbf4d´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$5744c00e-ff55-4cff-b2ed-7079c341175e„´precedence_heuristic §cell_idÙ$5744c00e-ff55-4cff-b2ed-7079c341175e´downstream_cells_map€²upstream_cells_map…¡:�¡-�¤plot�¢Ï€�£sin�Ù$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9e„´precedence_heuristic§cell_idÙ$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9e´downstream_cells_map„¥Plots�«@shorthands�¬LaTeXStrings�§@recipe‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4²upstream_cells_map€Ù$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7„´precedence_heuristic §cell_idÙ$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7´downstream_cells_map€²upstream_cells_mapƒ¨semilogy‘Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4¡:�¡^�Ù$fe019b21-c774-49ff-981c-0487f0b07d42„´precedence_heuristic §cell_idÙ$fe019b21-c774-49ff-981c-0487f0b07d42´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$e44c2429-fc7c-4609-b27c-4b527a7b8440„´precedence_heuristic §cell_idÙ$e44c2429-fc7c-4609-b27c-4b527a7b8440´downstream_cells_map€²upstream_cells_map‚¤plot�£sin�´cell_execution_orderÜÙ$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9eÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54Ù$679f9791-df49-47f6-b5e0-562737f265b5Ù$fe019b21-c774-49ff-981c-0487f0b07d42Ù$e44c2429-fc7c-4609-b27c-4b527a7b8440Ù$83905cd7-4548-482b-9514-3b9ef2d99e67Ù$5744c00e-ff55-4cff-b2ed-7079c341175eÙ$b1c45986-eb23-42aa-ba27-8269686ad626Ù$aeab03ea-5947-4088-b60e-d1b32e98d164Ù$9e90b55e-863a-4d6f-91d1-84e15ad1edd7Ù$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3Ù$25a968c0-4209-44e5-8e9a-ba580e0fbf4dÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22Ù$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2Ù$86a17ea2-ce2c-44a5-ad69-b30b280dfb41Ù$a5c86153-8430-4336-a82f-c671b2c63eb5Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4Ù$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7´last_hot_reload_timeË©shortpath¨plots.jl®process_status¥ready¤pathÙL/home/runner/work/T4APlutoExamples/T4APlutoExamples/pluto_notebooks/plots.jl­pluto_version§v0.20.3®last_save_timeËAÙÒQøpCªcell_orderÜÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54Ù$679f9791-df49-47f6-b5e0-562737f265b5Ù$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9eÙ$fe019b21-c774-49ff-981c-0487f0b07d42Ù$e44c2429-fc7c-4609-b27c-4b527a7b8440Ù$83905cd7-4548-482b-9514-3b9ef2d99e67Ù$5744c00e-ff55-4cff-b2ed-7079c341175eÙ$b1c45986-eb23-42aa-ba27-8269686ad626Ù$aeab03ea-5947-4088-b60e-d1b32e98d164Ù$9e90b55e-863a-4d6f-91d1-84e15ad1edd7Ù$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3Ù$25a968c0-4209-44e5-8e9a-ba580e0fbf4dÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22Ù$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2Ù$86a17ea2-ce2c-44a5-ad69-b30b280dfb41Ù$a5c86153-8430-4336-a82f-c671b2c63eb5Ù$0ece0753-f329-43e6-9a34-99eeb7345cf4Ù$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7±published_objects€¥nbpkgНinstall_time_nsÏ)Y‡õ¬instantiatedòinstalled_versions‚¥Plots¦1.40.9¬LaTeXStrings¥1.4.0°terminal_outputsƒªnbpkg_syncÚ@ Instantiating... === Resolving... ===  No Changes to `/tmp/jl_sxD8Dy/Project.toml`  No Changes to `/tmp/jl_sxD8Dy/Manifest.toml` Precompiling... ===  Activating project at `/tmp/jl_sxD8Dy`¥PlotsÚ@ Instantiating... === Resolving... ===  No Changes to `/tmp/jl_sxD8Dy/Project.toml`  No Changes to `/tmp/jl_sxD8Dy/Manifest.toml` Precompiling... ===  Activating project at `/tmp/jl_sxD8Dy`¬LaTeXStringsÚ@ Instantiating... === Resolving... ===  No Changes to `/tmp/jl_sxD8Dy/Project.toml`  No Changes to `/tmp/jl_sxD8Dy/Manifest.toml` Precompiling... ===  Activating project at `/tmp/jl_sxD8Dy`§enabled÷restart_recommended_msgÀ´restart_required_msgÀ­busy_packages�¶waiting_for_permissionÂÙ,waiting_for_permission_but_probably_disabled«cell_inputsÞÙ$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2„§cell_idÙ$c8b63bfc-3ef3-41b5-9f9f-7b59a5c0cce2¤codeÙzmd""" Of course, we can also pass the z-coordinates of the data (`z`) as the third argument to the `heatmap` function. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$a5c86153-8430-4336-a82f-c671b2c63eb5„§cell_idÙ$a5c86153-8430-4336-a82f-c671b2c63eb5¤codeÚmd""" ## Defining a custom seriestype We can define a custom seriestype by creating a new struct and defining a [recipe](https://docs.juliaplots.org/stable/recipes/#recipes) for it. Here we define a custom seriestype `SemiLogy` that plots the y-axis on a logarithmic scale. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$86a17ea2-ce2c-44a5-ad69-b30b280dfb41„§cell_idÙ$86a17ea2-ce2c-44a5-ad69-b30b280dfb41¤codeÙtlet x = 1:20 y = 1:3 f(x, y) = 2x + y @show size(f.(x', y)) z = f.(x', y) heatmap(x, y, z) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54„§cell_idÙ$8cabb3ac-bd6f-496c-84b2-bb536ba0ff54¤codeÚzmd""" To run this notebook plots.jl locally, copy and paste the following into your Julia REPL: ```julia using Pkg; Pkg.activate(temp=true); Pkg.add("Pluto") BASE_URL = "https://raw.githubusercontent.com/tensor4all/T4APlutoExamples/refs/heads/main/pluto_notebooks/" notebook = "plots.jl" url = joinpath(BASE_URL, notebook) using Pluto; Pluto.run(notebook=download(url)) ``` """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$b1c45986-eb23-42aa-ba27-8269686ad626„§cell_idÙ$b1c45986-eb23-42aa-ba27-8269686ad626¤codeÙ¹md""" We can draw multiple functions on a same plot pane using `plot!` function. The following example demonstrates plotting the sine function $y = \sin(x)$ for $x \in [-\pi, \pi]$. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22„§cell_idÙ$f1871cd6-8d8c-4e38-920b-c3f145513b22¤codeÙKlet x = 1:20 y = 1:3 f(x, y) = 2x + y heatmap(x, y, f) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$679f9791-df49-47f6-b5e0-562737f265b5„§cell_idÙ$679f9791-df49-47f6-b5e0-562737f265b5¤codeÙðmd""" # Introduction to Plots.jl This guide provides an introduction to [Plots.jl](https://docs.juliaplots.org/stable/), a powerful and flexible plotting package for Julia. Plots.jl is a widely used Julia package for data visualization. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$0ece0753-f329-43e6-9a34-99eeb7345cf4„§cell_idÙ$0ece0753-f329-43e6-9a34-99eeb7345cf4¤codeÚ_begin # defines mutable struct `SemiLogy` and sets shorthands # `semilogy` and `semilogy!` @userplot SemiLogy @recipe function f(t::SemiLogy) x = t.args[begin] y = t.args[end] ε = nextfloat(0.0) yscale := :log10 # Adding ε avoids getting log10(0) from being -Inf (x, ε .+ y) end end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3„§cell_idÙ$5e630874-2ce5-4a8a-9cc0-c2474a9a6fa3¤codeÙflet x = 1:10 y = rand(10) plt = plot() plot!(x, y) scatter!(x, y, label="scatter", marker=:x) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$aeab03ea-5947-4088-b60e-d1b32e98d164„§cell_idÙ$aeab03ea-5947-4088-b60e-d1b32e98d164¤codeÙ³let x = -Ï€:0.1:Ï€ y1 = sin.(x) y2 = cos.(x) plt = plot() # line plot plot!(plt, x, y1, label="sin") # scatter plot plot!(plt, x, y2, label="cos", seriestype=:scatter) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$83905cd7-4548-482b-9514-3b9ef2d99e67„§cell_idÙ$83905cd7-4548-482b-9514-3b9ef2d99e67¤codeÙ�md""" Additionally, we can provide x-coordinates (`x`) and y-coordinates (`y`) as arguments to the `plot` function to create custom plots."""¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$9e90b55e-863a-4d6f-91d1-84e15ad1edd7„§cell_idÙ$9e90b55e-863a-4d6f-91d1-84e15ad1edd7¤codeÙqmd""" Instead of specifying `seriestype=:scatter`, we can use the `scatter` or `scatter!` functions directly. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$25a968c0-4209-44e5-8e9a-ba580e0fbf4d„§cell_idÙ$25a968c0-4209-44e5-8e9a-ba580e0fbf4d¤codeÙlmd""" ## Heatmap We can use the `heatmap` function to visualize a function on a two-dimensional domain. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$5744c00e-ff55-4cff-b2ed-7079c341175e„§cell_idÙ$5744c00e-ff55-4cff-b2ed-7079c341175e¤codeÙJlet x = -Ï€:0.1:Ï€ y = sin.(x) # line plot plot(x, y, label="sin") end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9e„§cell_idÙ$a76d8151-fb1d-4dcb-aaf7-eb7f3d3c1f9e¤codeÙcbegin using Plots using Plots.RecipesBase: @recipe, @shorthands using LaTeXStrings end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7„§cell_idÙ$fa8f001c-e55b-457e-ae4e-80cf7aa1ffd7¤codeÙ(semilogy((-10:1:-7), 10.0 .^ (-10:1:-7))¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$fe019b21-c774-49ff-981c-0487f0b07d42„§cell_idÙ$fe019b21-c774-49ff-981c-0487f0b07d42¤codeÙYmd""" To plot a given function, we can pass it as an argument to the `plot` function. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$e44c2429-fc7c-4609-b27c-4b527a7b8440„§cell_idÙ$e44c2429-fc7c-4609-b27c-4b527a7b8440¤code©plot(sin)¨metadataƒ©show_logsèdisabled®skip_as_script«code_folded«notebook_idÙ$558c1c64-ae0d-11ef-030a-e9b821d95c74«in_temp_dir¨metadata€