### Histogram Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Demonstrates the creation of a histogram. This example includes the necessary setup and plotting commands. ```cpp --8<-- "examples/data_distribution/histogram/histogram_1.cpp" ``` -------------------------------- ### Geoplot Example 7 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Offers a seventh geoplotting example. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_7.cpp" ``` -------------------------------- ### Tiled Layout Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates a basic tiled layout. No specific setup or constraints are mentioned. ```cpp #include #include #include "matplot/matplot.h" int main() { std::vector x = {-2, -1, 0, 1, 2}; std::vector y = {4, 1, 0, 1, 4}; auto p = matplot::figure(false); p->width(600); p->height(600); matplot::subplot(2, 2, 0); matplot::plot(x, y); matplot::title("Subplot 1"); matplot::subplot(2, 2, 1); matplot::plot(y, x); matplot::title("Subplot 2"); matplot::subplot(2, 2, 2); matplot::plot(x, -y.data(), "--r"); matplot::title("Subplot 3"); matplot::subplot(2, 2, 3); matplot::plot(-x.data(), -y.data(), ":g"); matplot::title("Subplot 4"); matplot::show(); } ``` -------------------------------- ### View Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/examples.md Demonstrates basic view settings in Matplot++. No specific setup required beyond including the library. ```cpp #include int main() { std::vector x = {1, 2, 3, 4, 5}; std::vector y = {2, 3, 5, 4, 6}; std::plot(x, y); std::save( ``` -------------------------------- ### Geoplot Example 6 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Provides a sixth geoplotting example. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_6.cpp" ``` -------------------------------- ### Process Example Images Source: https://github.com/alandefreitas/matplotplusplus/blob/master/examples/images/imshow/CMakeLists.txt This CMake script finds all image files starting with 'lena_' and copies them to the build directory. This is typically used to ensure example images are available during the build process. ```cmake file(GLOB ALL_EXAMPLE_IMGS lena_*) foreach (EXAMPLE_IMG ${ALL_EXAMPLE_IMGS}) get_filename_component(EXAMPLE_IMG_NAME ${EXAMPLE_IMG} NAME) configure_file(${EXAMPLE_IMG_NAME} ${EXAMPLE_IMG_NAME} COPYONLY) endforeach () ``` -------------------------------- ### Geoplot Example 5 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Features a fifth geoplotting example. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_5.cpp" ``` -------------------------------- ### Install Matplot++ on Windows with MSVC (No Examples/Tests) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Installs Matplot++ on Windows using CMake, disabling example and test builds. This command installs the library to the system. ```bash mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="/O2" -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF cmake --build . --parallel 2 --config Release cmake --install . ``` -------------------------------- ### Geoplot Example 4 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Presents an additional geoplotting example. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_4.cpp" ``` -------------------------------- ### Install Matplot++ on Ubuntu with GCC (No Examples/Tests) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Installs Matplot++ on Ubuntu using CMake, disabling example and test builds. This command installs the library to the system. ```bash mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF sudo cmake --build . --parallel 2 --config Release sudo cmake --install . ``` -------------------------------- ### imshow Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This is the first example demonstrating the `imshow` function. It is part of a series of examples showcasing image display capabilities. ```cpp --8<-- "examples/images/imshow/imshow_1.cpp" ``` -------------------------------- ### Bar Plot Example 7 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_7.cpp" ``` -------------------------------- ### Box Styles Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates basic box styling for axes. No specific setup required beyond including the Matplot++ library. ```cpp #include "../examples/appearance/axis/box/box_1.cpp" ``` -------------------------------- ### Bar Plot Example 5 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_5.cpp" ``` -------------------------------- ### Bar Plot Example 2 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_2.cpp" ``` -------------------------------- ### Legend Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_1.cpp" ``` -------------------------------- ### Bar Plot Example 10 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_10.cpp" ``` -------------------------------- ### Fence Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates the creation of a basic fence plot. No specific setup required beyond including the necessary headers. ```cpp #include int main() { std::vector x = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; std::vector y = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100}; std::vector> z = { {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100}, {0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000}, {0, 1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000}, {0, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000}, {0, 1, 64, 729, 4096, 15625, 46656, 117649, 262144, 531441, 1000000} }; matplot::fence(x, y, z); matplot::show(); return 0; } ``` -------------------------------- ### Bar Plot Example 11 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_11.cpp" ``` -------------------------------- ### Bar Plot Example 6 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_6.cpp" ``` -------------------------------- ### Bar Plot Example 8 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_8.cpp" ``` -------------------------------- ### Bar Plot Example 1 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_1.cpp" ``` -------------------------------- ### Bar Plot Example 13 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_13.cpp" ``` -------------------------------- ### Legend Example 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_2.cpp" ``` -------------------------------- ### Bar Plot Example 12 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_12.cpp" ``` -------------------------------- ### Bar Plot Example 9 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_9.cpp" ``` -------------------------------- ### Bar Plot Example 3 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_3.cpp" ``` -------------------------------- ### Pareto Chart Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code snippet demonstrates the creation of a Pareto chart. It includes necessary setup for plotting. ```cpp --8<-- "examples/discrete_data/pareto/pareto_1.cpp" ``` -------------------------------- ### Geoplot Example 3 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Illustrates a further geoplotting scenario. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_3.cpp" ``` -------------------------------- ### Install GCC-10 on Ubuntu Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Install GCC-10 on Ubuntu systems using a testing repository. Ensure build-essential is installed first. ```bash sudo apt install build-essential sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt install g++-10 ``` -------------------------------- ### Fence Example 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Another fence plot example. Ensure Matplotlib++ is correctly installed and included. ```cpp #include int main() { std::vector x = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; std::vector y = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100}; std::vector> z = { {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100}, {0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000}, {0, 1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000}, {0, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000}, {0, 1, 64, 729, 4096, 15625, 46656, 117649, 262144, 531441, 1000000} }; matplot::fence(x, y, z, "--r"); matplot::show(); return 0; } ``` -------------------------------- ### Geobubble Example 1 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Illustrates the creation of a geobubble plot. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geobubble/geobubble_1.cpp" ``` -------------------------------- ### Geoplot Example 2 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Shows another variation of geoplotting. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_2.cpp" ``` -------------------------------- ### Example: Z-Axis Limits (zlim_1.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates setting Z-axis limits. Ensure the `zlim` function is called with the desired minimum and maximum values. ```cpp --8<-- "examples/appearance/axis/zlim/zlim_1.cpp" ``` -------------------------------- ### Include Grid Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the grid feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/grid/grid/grid_1.cpp" ``` -------------------------------- ### Example: Z-Axis Limits (zlim_5.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Shows how to configure Z-axis limits using the `zlim` function. ```cpp --8<-- "examples/appearance/axis/zlim/zlim_5.cpp" ``` -------------------------------- ### Geoplot Example 1 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates the basic usage of geoplot functionality. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoplot/geoplot_1.cpp" ``` -------------------------------- ### Include Grid Example 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the grid feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/grid/grid/grid_2.cpp" ``` -------------------------------- ### Install Matplot++ on macOS with Clang (No Examples/Tests) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Installs Matplot++ on macOS using CMake, disabling example and test builds. This command installs the library to the system. ```bash mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF cmake --build . --parallel 2 --config Release cmake --install . ``` -------------------------------- ### Build Matplot++ Examples Source: https://github.com/alandefreitas/matplotplusplus/blob/master/index.md Builds the Matplot++ library and its examples. Ensure you are in the build directory. Replace -O2 with /O2 on Windows. ```bash mkdir build cmake -version cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" cmake --build . -j 2 --config Release ``` -------------------------------- ### Color Order Example 3 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example illustrates a different color order setup. The code is sourced from 'examples/appearance/multiplot/colororder/colororder_3.cpp'. ```cpp --8<-- "examples/appearance/multiplot/colororder/colororder_3.cpp" ``` -------------------------------- ### Example Usage of OpenGL Backend Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code demonstrates the usage of the experimental OpenGL backend. It is located in the test directory and serves as an example for integrating with OpenGL. ```cpp #include int main() { // Example usage of OpenGL backend return 0; } ``` -------------------------------- ### Matplot++ Colormap Examples Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates different colormap applications in Matplot++. No specific setup required beyond including the Matplot++ library. ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("viridis"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("parula"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("jet"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("hsv"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("hot"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("cool"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("spring"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("summer"); matplot::show(); } ``` ```cpp #include int main() { auto x = std::vector(101); std::iota(x.begin(), x.end(), 0); auto y = x; auto z = std::vector>(101, std::vector(101)); for (auto i = 0; i < 101; ++i) { for (auto j = 0; j < 101; ++j) { z[i][j] = std::sin(std::sqrt(x[i] * x[i] + y[j] * y[j])); } } matplot::surf(x, y, z); matplot::colormap("autumn"); matplot::show(); } ``` -------------------------------- ### Geobubble Example 2 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Presents a second geobubble plot example. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geobubble/geobubble_2.cpp" ``` -------------------------------- ### Example Save 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates saving a plot, likely with different data or styling, to a file. ```cpp --8<-- "examples/exporting/save/save_2.cpp" ``` -------------------------------- ### Geoscatter Plot Example 2 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Shows a second example of a geoscatter plot. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoscatter/geoscatter_2.cpp" ``` -------------------------------- ### Legend Example 8 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_8.cpp" ``` -------------------------------- ### Legend Example 7 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_7.cpp" ``` -------------------------------- ### Include Box Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the box feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/axis/box/box_1.cpp" ``` -------------------------------- ### Example: surf_5.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a surface plot. ```cpp --8<-- "examples/surfaces/surf/surf_5.cpp" ``` -------------------------------- ### Legend Example 6 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_6.cpp" ``` -------------------------------- ### Legend Example 5 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_5.cpp" ``` -------------------------------- ### Include Box Example 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the box feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/axis/box/box_2.cpp" ``` -------------------------------- ### Legend Example 4 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_4.cpp" ``` -------------------------------- ### Include Grid Example 3 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the grid feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/grid/grid/grid_3.cpp" ``` -------------------------------- ### Legend Example 3 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating legend creation. It includes necessary includes and plot setup. ```cpp --8<-- "examples/appearance/labels/legend/legend_3.cpp" ``` -------------------------------- ### Example: surf_3.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a surface plot. ```cpp --8<-- "examples/surfaces/surf/surf_3.cpp" ``` -------------------------------- ### Example: surf_1.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a surface plot. ```cpp --8<-- "examples/surfaces/surf/surf_1.cpp" ``` -------------------------------- ### Example: Z-Axis Limits (zlim_4.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Demonstrates the application of `zlim` for Z-axis range control. ```cpp --8<-- "examples/appearance/axis/zlim/zlim_4.cpp" ``` -------------------------------- ### Example: surf_2.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a surface plot. ```cpp --8<-- "examples/surfaces/surf/surf_2.cpp" ``` -------------------------------- ### Install Clang on macOS Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Download and install Clang and LLVM from a release archive on macOS. Files are copied to /usr/local. ```bash # download clang curl --output clang.tar.xz -L https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz mkdir clang tar -xvJf clang.tar.xz -C clang # copy files to /usr/local cd clang/clang+llvm-11.0.0-x86_64-apple-darwin sudo cp -R * /usr/local/ ``` -------------------------------- ### Pie Chart Example Source: https://github.com/alandefreitas/matplotplusplus/blob/master/examples.md Illustrates how to create a pie chart. Pie charts are suitable for displaying proportions of a whole. ```cpp #include #include int main() { std::vector sizes = {1, 2, 3, 4, 5}; std::vector labels = {"A", "B", "C", "D", "E"}; matplot::pie(sizes, labels); matplot::show(); return 0; } ``` -------------------------------- ### Example: surf_6.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a surface plot. ```cpp --8<-- "examples/surfaces/surf/surf_6.cpp" ``` -------------------------------- ### Example: Adjust Axis (axis_8.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example shows the final configuration of axis limits. ```cpp --8<-- "examples/appearance/axis/axis/axis_8.cpp" ``` -------------------------------- ### Example: Z-Axis Limits (zlim_6.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example provides a further illustration of setting Z-axis limits. ```cpp --8<-- "examples/appearance/axis/zlim/zlim_6.cpp" ``` -------------------------------- ### Bar Plot Example 4 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates a specific bar plot configuration. It includes necessary includes and setup for plotting. ```cpp --8<-- "examples/discrete_data/bar/bar_4.cpp" ``` -------------------------------- ### Include Grid Example 4 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the grid feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/grid/grid/grid_4.cpp" ``` -------------------------------- ### Example: surf_4.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a surface plot. ```cpp --8<-- "examples/surfaces/surf/surf_4.cpp" ``` -------------------------------- ### Include Box Example 3 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet is part of a larger example demonstrating the box feature. It is included via a file reference. ```cpp --8<-- "examples/appearance/axis/box/box_3.cpp" ``` -------------------------------- ### Example: Adjust Axis (axis_5.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Shows how to configure axis ranges using the `axis` function. ```cpp --8<-- "examples/appearance/axis/axis/axis_5.cpp" ``` -------------------------------- ### Polar Line Plot Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code generates the first example of a polar line plot. It includes necessary setup for plotting. ```cpp --8<-- "examples/polar_plots/polarplot/polarplot_1.cpp" ``` -------------------------------- ### Example: Z-Axis Limits (zlim_2.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Another example for setting Z-axis limits, showcasing different values or scenarios. ```cpp --8<-- "examples/appearance/axis/zlim/zlim_2.cpp" ``` -------------------------------- ### Example: Z-Axis Limits (zlim_3.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet illustrates setting Z-axis limits with specific parameters. ```cpp --8<-- "examples/appearance/axis/zlim/zlim_3.cpp" ``` -------------------------------- ### X Ticks Example 8 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Final example for X-axis tick customization, potentially covering edge cases or complex scenarios. Verify Matplot++ installation. ```cpp #include "../examples/appearance/grid/xticks/xticks_8.cpp" ``` -------------------------------- ### Example: image_1.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code snippet demonstrates the usage of the `image()` function. ```cpp --8<-- "examples/images/image/image_1.cpp" ``` -------------------------------- ### 3D Function Plot Example Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates plotting a 3D function. Ensure Matplot++ is installed and linked. ```cpp #include #include #include "matplot/matplot.h" int main() { using namespace matplot; std::vector x(100), y(100), z(100); for (int i = 0; i < 100; ++i) { x[i] = i / 10.0; y[i] = std::sin(x[i]); z[i] = std::cos(x[i]); } auto p = fplot3(x, y, z); p->show(); return 0; } ``` ```cpp #include #include #include "matplot/matplot.h" int main() { using namespace matplot; std::vector x(100), y(100), z(100); for (int i = 0; i < 100; ++i) { x[i] = i / 10.0; y[i] = std::sin(x[i]); z[i] = std::tan(x[i]); } auto p = fplot3(x, y, z); p->show(); return 0; } ``` ```cpp #include #include #include "matplot/matplot.h" int main() { using namespace matplot; std::vector x(100), y(100), z(100); for (int i = 0; i < 100; ++i) { x[i] = i / 10.0; y[i] = std::sin(x[i]); z[i] = std::exp(x[i]); } auto p = fplot3(x, y, z); p->show(); return 0; } ``` ```cpp #include #include #include "matplot/matplot.h" int main() { using namespace matplot; std::vector x(100), y(100), z(100); for (int i = 0; i < 100; ++i) { x[i] = i / 10.0; y[i] = std::sin(x[i]); z[i] = std::log(x[i] + 1); } auto p = fplot3(x, y, z); p->show(); return 0; } ``` ```cpp #include #include #include "matplot/matplot.h" int main() { using namespace matplot; std::vector x(100), y(100), z(100); for (int i = 0; i < 100; ++i) { x[i] = i / 10.0; y[i] = std::sin(x[i]); z[i] = std::pow(x[i], 2); } auto p = fplot3(x, y, z); p->show(); return 0; } ``` -------------------------------- ### Example Save 8 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example demonstrates saving a plot to a file, potentially in a raster format like PNG. ```cpp --8<-- "examples/exporting/save/save_8.cpp" ``` -------------------------------- ### Y Ticks Example 8 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_8.cpp" ``` -------------------------------- ### fcontour Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This is the first example of using the `fcontour` function. ```cpp --8<-- "examples/contour_plots/fcontour/fcontour_1.cpp" ``` -------------------------------- ### Y Ticks Example 7 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_7.cpp" ``` -------------------------------- ### Example: mesh_1.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a mesh plot. ```cpp --8<-- "examples/surfaces/mesh/mesh_1.cpp" ``` -------------------------------- ### Y Ticks Example 6 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_6.cpp" ``` -------------------------------- ### Example: image_2.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code snippet demonstrates the usage of the `image()` function. ```cpp --8<-- "examples/images/image/image_2.cpp" ``` -------------------------------- ### Y Ticks Example 5 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_5.cpp" ``` -------------------------------- ### Y Ticks Example 4 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_4.cpp" ``` -------------------------------- ### Y Ticks Example 3 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_3.cpp" ``` -------------------------------- ### Y Ticks Example 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_2.cpp" ``` -------------------------------- ### Example: image_5.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code snippet demonstrates the usage of the `image()` function. ```cpp --8<-- "examples/images/image/image_5.cpp" ``` -------------------------------- ### Y Ticks Example 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This snippet demonstrates setting Y-axis ticks. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/grid/yticks/yticks_1.cpp" ``` -------------------------------- ### Example: mesh_3.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a mesh plot. ```cpp --8<-- "examples/surfaces/mesh/mesh_3.cpp" ``` -------------------------------- ### Example: Adjust Axis (axis_6.cpp) Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example provides a further illustration of setting axis limits. ```cpp --8<-- "examples/appearance/axis/axis/axis_6.cpp" ``` -------------------------------- ### X-Axis Ticks Example Source: https://github.com/alandefreitas/matplotplusplus/blob/master/examples.md Demonstrates how to configure the appearance and labels of X-axis ticks. This example is useful for precise control over tick placement and labeling. ```cpp #include "../examples.h" #include #include int main(int argc, char **argv) { if (argc < 2) return EXIT_FAILURE; // Set X-axis ticks auto plot = std::make_shared(); std::vector x_labels = {"A", "B", "C", "D"}; std::vector y_data1 = {1, 3, 2, 4}; std::vector y_data2 = {2, 1, 4, 3}; plot->XTicks(x_labels); plot->Add(x_labels, y_data1); plot->Add(x_labels, y_data2); // Save plot plot->Save(argv[1]); return EXIT_SUCCESS; } ``` -------------------------------- ### Basic 3D Stem Plot Example Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates a basic 3D stem plot. Ensure Matplotlib++ is installed. ```cpp #include int main() { std::vector x = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; std::vector y = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81}; std::vector z = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; matplot::stem3(x, y, z); matplot::show(); return 0; } ``` -------------------------------- ### Example: mesh_2.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Full C++ example for generating a mesh plot. ```cpp --8<-- "examples/surfaces/mesh/mesh_2.cpp" ``` -------------------------------- ### Basic Stem Plot Example Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates a basic stem plot. Ensure Matplotlib++ is installed and included in your project. ```cpp #include int main() { std::vector x = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; std::vector y = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81}; matplot::stem(x, y); matplot::show(); return 0; } ``` -------------------------------- ### Tiled Layout Example 7 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Demonstrates a tiled layout that adapts to available space. If a tile doesn't fit, the layout adjusts by increasing rows or columns, offering a simplified approach to multi-plot figures. ```cpp --8<-- "examples/appearance/multiplot/tiledlayout/tiledlayout_7.cpp" ``` -------------------------------- ### Geodensity Plot Example 1 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates how to generate a geodensity plot. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geodensityplot/geodensityplot_1.cpp" ``` -------------------------------- ### Example: image_3.cpp Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code snippet demonstrates the usage of the `image()` function. ```cpp --8<-- "examples/images/image/image_3.cpp" ``` -------------------------------- ### Geoscatter Plot Example 1 in C++ Source: https://github.com/alandefreitas/matplotplusplus/blob/master/docs/COMPLETE_GALLERY.md Demonstrates the usage of geoscatter plot functionality. No specific setup or constraints are mentioned. ```cpp #include "../examples/geography/geoscatter/geoscatter_1.cpp" ``` -------------------------------- ### Example Save 3 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This example shows saving a plot to a file, potentially with specific formatting or data. ```cpp --8<-- "examples/exporting/save/save_3.cpp" ``` -------------------------------- ### imshow Example 2 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md Second example for `imshow`. This snippet is part of a collection illustrating various image display scenarios. ```cpp --8<-- "examples/images/imshow/imshow_2.cpp" ``` -------------------------------- ### Example: Hold On 1 Source: https://github.com/alandefreitas/matplotplusplus/blob/master/README.md This C++ code snippet demonstrates enabling the hold function for multiplots. It includes necessary setup for plotting. ```cpp --8<-- "examples/appearance/multiplot/hold/hold_1.cpp" ```