From f896db29dc10ed73ae09fe0f58ee2f0c8a9ccac0 Mon Sep 17 00:00:00 2001 From: Faisal Date: Mon, 2 Feb 2026 21:05:17 -0500 Subject: [PATCH 1/9] Fix scatter colormap crash after clean_figure deduplication --- src/matplot2tikz/_path.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/matplot2tikz/_path.py b/src/matplot2tikz/_path.py index e1da1cd0..d7532a11 100644 --- a/src/matplot2tikz/_path.py +++ b/src/matplot2tikz/_path.py @@ -248,6 +248,10 @@ def draw_pathcollection(data: TikzData, obj: PathCollection) -> list[str]: def _draw_pathcollection_scatter_colormap(data: TikzData, pcd: PathCollectionData) -> None: obj_array = pcd.obj.get_array() if obj_array is not None: + # clean_figure() can cause a mismatch in color array len, so check and truncate as needed + if len(obj_array) != len(pcd.dd_strings): + obj_array = obj_array[: len(pcd.dd_strings)] + pcd.dd_strings = np.column_stack([pcd.dd_strings, obj_array]) pcd.labels.append("colordata") pcd.draw_options.append("scatter src=explicit") From b0f23792060ba9740a7c31d3d5c81ad07e3bbd30 Mon Sep 17 00:00:00 2001 From: Faisal Date: Mon, 2 Feb 2026 22:07:59 -0500 Subject: [PATCH 2/9] Fixed clean_figure() not working after adding a plot --- src/matplot2tikz/_cleanfigure.py | 36 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/matplot2tikz/_cleanfigure.py b/src/matplot2tikz/_cleanfigure.py index d56464d0..cfe51c00 100644 --- a/src/matplot2tikz/_cleanfigure.py +++ b/src/matplot2tikz/_cleanfigure.py @@ -370,23 +370,33 @@ def _remove_nans(data: np.ndarray) -> np.ndarray: I.e., those at the end/beginning of the data and consecutive ones. """ + + # do nothing if data is empty, as it would be after a call to clean_figure() + if data.size == 0: + return data + id_nan = np.any(np.isnan(data), axis=1) + + # Likewise guard against all rows being NaN + valid = np.argwhere(~id_nan).reshape((-1,)) + + if valid.size == 0: + return data[:0] + id_remove = np.argwhere(id_nan).reshape((-1,)) - if not _isempty(id_remove): - id_remove = id_remove[ - np.concatenate([np.diff(id_remove, axis=0) == 1, np.array([False]).reshape((-1,))]) - ] + if id_remove.size != 0: + consecutive = np.diff(id_remove) == 1 + id_remove = id_remove[np.concatenate([consecutive, np.array([False])])] - id_first = np.argwhere(np.logical_not(id_nan))[0] - id_last = np.argwhere(np.logical_not(id_nan))[-1] + id_first = valid[0] + id_last = valid[-1] + + id_remove = np.concatenate( + [np.arange(0, id_first), + id_remove, + np.arange(id_last + 1, len(data))] + ) - if _isempty(id_first): - # remove entire data - id_remove = np.arange(len(data)) - else: - id_remove = np.concatenate( - [np.arange(0, id_first[0]), id_remove, np.arange(id_last[0] + 1, len(data))] - ) return np.delete(data, id_remove, axis=0) From a2add184ad66fe5f4cc62712eef3d78e67a1d23e Mon Sep 17 00:00:00 2001 From: Alex <107329684+AlexChrzanowski@users.noreply.github.com> Date: Fri, 6 Feb 2026 09:15:37 -0500 Subject: [PATCH 3/9] Update PR trigger to target main branch Modify pull request trigger to only run on main branch. --- .github/workflows/tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 763ee90a..4d7321ff 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,7 +1,9 @@ name: Tests on: - - pull_request + pull_request: + branches: + - main # Only runs if the PR is aiming to merge INTO main jobs: test: From 236409d08d0c365fefba5da167d460e86b26bc7d Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 7 Feb 2026 20:17:38 -0500 Subject: [PATCH 4/9] Explicit height/width sizing Adds support for figsize=(x,y) within the figure. Also now explicitly follows internal matplotlib height/width sizing. --- src/matplot2tikz/_axes.py | 4 ++ src/matplot2tikz/_save.py | 62 ++++++++++++------- tests/test_annotate_reference.tex | 2 + tests/test_arrows_reference.tex | 2 + tests/test_axvline_reference.tex | 2 + tests/test_barchart_errorbars_reference.tex | 2 + tests/test_barchart_legend_reference.tex | 2 + tests/test_barchart_logy_reference.tex | 2 + tests/test_barchart_reference.tex | 2 + tests/test_basic_sin_reference.tex | 2 + tests/test_boxplot_reference.tex | 2 + tests/test_context_reference.tex | 2 + tests/test_contourf_reference.tex | 2 + tests/test_custom_collection_reference.tex | 2 + tests/test_datetime_paths_reference.tex | 2 + tests/test_datetime_reference.tex | 2 + tests/test_errorband_reference.tex | 2 + tests/test_errorbar_reference.tex | 2 + tests/test_escape_chars_reference.tex | 2 + tests/test_externalize_tables_reference.tex | 2 + tests/test_fancy_colorbar_reference.tex | 2 + tests/test_fillstyle_reference.tex | 2 + tests/test_heat_reference.tex | 2 + tests/test_histogram_reference.tex | 2 + tests/test_horizontal_alignment_reference.tex | 2 + tests/test_image_plot_lower_reference.tex | 2 + tests/test_image_plot_upper_reference.tex | 2 + tests/test_legend3_reference.tex | 2 + tests/test_legend_columns_reference.tex | 2 + tests/test_legend_labels_reference.tex | 2 + tests/test_legend_line_scatter_reference.tex | 2 + tests/test_legends_reference.tex | 2 + tests/test_line_collection_reference.tex | 2 + tests/test_line_color_marker_reference.tex | 2 + tests/test_line_dashes_reference.tex | 2 + tests/test_line_set_data_reference.tex | 2 + tests/test_loglogplot_reference.tex | 2 + tests/test_logplot_base_reference.tex | 2 + tests/test_logplot_reference.tex | 2 + tests/test_marker_reference.tex | 2 + tests/test_multi_line_title_reference.tex | 2 + tests/test_noise2_reference.tex | 2 + tests/test_noise_reference.tex | 2 + tests/test_pandas_dataframe_reference.tex | 2 + tests/test_patch_styles_reference.tex | 2 + tests/test_patches_reference.tex | 2 + tests/test_scatter_colormap_reference.tex | 2 + ...est_scatter_different_colors_reference.tex | 2 + ...test_scatter_different_sizes_reference.tex | 2 + tests/test_scatter_reference.tex | 2 + tests/test_steps_reference.tex | 2 + tests/test_text_overlay_reference.tex | 2 + tests/test_viridis_reference.tex | 2 + 53 files changed, 147 insertions(+), 21 deletions(-) diff --git a/src/matplot2tikz/_axes.py b/src/matplot2tikz/_axes.py index d9b28ced..c6cbb717 100644 --- a/src/matplot2tikz/_axes.py +++ b/src/matplot2tikz/_axes.py @@ -669,6 +669,10 @@ def _is_colorbar_heuristic(obj: Axes) -> bool: ) +# Public alias for use by _save when computing default axis dimensions. +is_colorbar_heuristic = _is_colorbar_heuristic + + def _mpl_cmap2pgf_cmap(cmap: Colormap, data: TikzData) -> tuple[str, bool]: """Converts a color map as given in matplotlib to a color map as represented in PGFPlots.""" if isinstance(cmap, LinearSegmentedColormap): diff --git a/src/matplot2tikz/_save.py b/src/matplot2tikz/_save.py index 39e86e73..2824f5a4 100644 --- a/src/matplot2tikz/_save.py +++ b/src/matplot2tikz/_save.py @@ -98,14 +98,19 @@ def get_tikz_code( # noqa: PLR0913 TikZ/PGFPlots output. If ``axis_height`` is not given, ``matplot2tikz`` will try to preserve the original width/height ratio. Note that ``axis_width`` can be a string literal, such as - ``'\\axis_width'``. + ``'\\axis_width'``. If both ``axis_width`` and ``axis_height`` + are omitted and the figure has a single (non-colorbar) axis, + they default to the figure size in inches (e.g. from + ``figsize`` in ``plt.subplots()``), with the ``"in"`` suffix. :type axis_width: str :param axis_height: If not ``None``, this will be used as figure height within the TikZ/PGFPlots output. If ``axis_width`` is not given, ``matplot2tikz`` will try to preserve the original width/height - ratio. Note that ``axis_width`` can be a string literal, such - as ``'\\axis_height'``. + ratio. Note that ``axis_height`` can be a string literal, such + as ``'\\axis_height'``. If both ``axis_width`` and + ``axis_height`` are omitted and the figure has a single + (non-colorbar) axis, they default to the figure size in inches. :type axis_height: str :param textsize: The text size (in pt) that the target latex document is using. @@ -279,6 +284,9 @@ def save( ) -> None: """Same as `get_tikz_code()`, but actually saves the code to a file. + All other arguments (e.g. ``axis_width``, ``axis_height``, ``figure``) are + passed through to `get_tikz_code()`; see that function for documentation. + :param filepath: The file to which the TikZ output will be written. :type filepath: str @@ -379,6 +387,32 @@ def _draw_collection(data: TikzData, child: Collection) -> list[str]: return _patch.draw_patchcollection(data, child) +def _set_default_axis_dimensions_from_figure(data: TikzData, fig: Figure) -> None: + """Set axis width/height from figure size (in) when both unset and one non-colorbar axis.""" + if data.axis_width is not None or data.axis_height is not None: + return + non_cb_axes = [a for a in fig.axes if not _axes.is_colorbar_heuristic(a)] + if len(non_cb_axes) != 1: + return + data.axis_width = f"{fig.get_figwidth():{data.float_format}}in" + data.axis_height = f"{fig.get_figheight():{data.float_format}}in" + + +def _should_skip_child(obj: Artist, child: Artist) -> bool: + """Return True if this child should be skipped (background patch, spine, invisible, etc.).""" + if ( + isinstance(obj, (Figure, Axes)) + and isinstance(child, Patch) + and child is obj.patch + and child.get_facecolor() == (1.0, 1.0, 1.0, 1.0) + and child.get_linewidth() == 0.0 + ) or not child.get_visible(): + return True + if isinstance(child, (Spine, XAxis, YAxis)): + return True + return type(child).__name__ == "_WCSAxesArtist" + + def _recurse(data: TikzData, obj: Artist) -> list: """Iterates over all children of the current object and gathers the contents. @@ -386,25 +420,11 @@ def _recurse(data: TikzData, obj: Artist) -> list: """ content = _ContentManager() - for child in obj.get_children(): - # Some patches are Spines, too; skip those entirely. - # See . - - # Filter out the Figure's/Axes' background patch - if ( - isinstance(obj, (Figure, Axes)) - and isinstance(child, Patch) - and child is obj.patch - and child.get_facecolor() == (1.0, 1.0, 1.0, 1.0) # White face color - and child.get_linewidth() == 0.0 - ) or not child.get_visible(): - continue - - if isinstance(child, (Spine, XAxis, YAxis)): - continue + if isinstance(obj, Figure): + _set_default_axis_dimensions_from_figure(data, obj) - # Skip WCS axes artist - it's a placeholder with no visible content - if type(child).__name__ == "_WCSAxesArtist": + for child in obj.get_children(): + if _should_skip_child(obj, child): continue if isinstance(child, Axes): diff --git a/tests/test_annotate_reference.tex b/tests/test_annotate_reference.tex index 428e72b7..6a604f91 100644 --- a/tests/test_annotate_reference.tex +++ b/tests/test_annotate_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=5in, tick align=outside, tick pos=left, +width=8in, x grid style={darkgray176}, xmin=-1, xmax=5, xtick style={color=black}, diff --git a/tests/test_arrows_reference.tex b/tests/test_arrows_reference.tex index b1c607e0..476a02b8 100644 --- a/tests/test_arrows_reference.tex +++ b/tests/test_arrows_reference.tex @@ -4,8 +4,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=5.6666667in, tick align=outside, tick pos=left, +width=5.3333333in, x grid style={darkgray176}, xmin=0, xmax=8, xtick style={color=black}, diff --git a/tests/test_axvline_reference.tex b/tests/test_axvline_reference.tex index 23b2d8e0..affaa690 100644 --- a/tests/test_axvline_reference.tex +++ b/tests/test_axvline_reference.tex @@ -4,8 +4,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-1.1365774, xmax=2.1074561, xtick style={color=black}, diff --git a/tests/test_barchart_errorbars_reference.tex b/tests/test_barchart_errorbars_reference.tex index b1166e6a..7fb012ce 100644 --- a/tests/test_barchart_errorbars_reference.tex +++ b/tests/test_barchart_errorbars_reference.tex @@ -5,8 +5,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.5125, xmax=2.5125, xtick style={color=black}, diff --git a/tests/test_barchart_legend_reference.tex b/tests/test_barchart_legend_reference.tex index 8e327105..5c035815 100644 --- a/tests/test_barchart_legend_reference.tex +++ b/tests/test_barchart_legend_reference.tex @@ -5,10 +5,12 @@ \definecolor{lightgray204}{RGB}{204,204,204} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=lightgray204}, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.5125, xmax=2.5125, xtick style={color=black}, diff --git a/tests/test_barchart_logy_reference.tex b/tests/test_barchart_logy_reference.tex index d1e4574d..1dc01537 100644 --- a/tests/test_barchart_logy_reference.tex +++ b/tests/test_barchart_logy_reference.tex @@ -4,9 +4,11 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, log basis y={10}, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0.36, xmax=5.64, xtick style={color=black}, diff --git a/tests/test_barchart_reference.tex b/tests/test_barchart_reference.tex index 3f8b3928..d7ec7018 100644 --- a/tests/test_barchart_reference.tex +++ b/tests/test_barchart_reference.tex @@ -4,8 +4,10 @@ \definecolor{green01270}{RGB}{0,127,0} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.5125, xmax=2.5125, xtick style={color=black}, diff --git a/tests/test_basic_sin_reference.tex b/tests/test_basic_sin_reference.tex index 500c98da..b0ae2800 100644 --- a/tests/test_basic_sin_reference.tex +++ b/tests/test_basic_sin_reference.tex @@ -9,6 +9,7 @@ \begin{axis}[ axis background/.style={fill=gainsboro229}, axis line style={white}, +height=4.8in, legend cell align={left}, legend style={ fill opacity=0.8, @@ -22,6 +23,7 @@ tick align=outside, tick pos=left, title={Simple plot \(\displaystyle \frac{\alpha}{2}\)}, +width=6.4in, x grid style={white}, xlabel=\textcolor{dimgray85}{time (s)}, xmajorgrids, diff --git a/tests/test_boxplot_reference.tex b/tests/test_boxplot_reference.tex index 6c14e594..95e53772 100644 --- a/tests/test_boxplot_reference.tex +++ b/tests/test_boxplot_reference.tex @@ -4,8 +4,10 @@ \definecolor{darkorange25512714}{RGB}{255,127,14} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0.5, xmax=3.5, xtick style={color=black}, diff --git a/tests/test_context_reference.tex b/tests/test_context_reference.tex index 3417eb91..4daebe93 100644 --- a/tests/test_context_reference.tex +++ b/tests/test_context_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \startaxis[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0, xmax=1, xtick style={color=black}, diff --git a/tests/test_contourf_reference.tex b/tests/test_contourf_reference.tex index cb07b440..bdfcce77 100644 --- a/tests/test_contourf_reference.tex +++ b/tests/test_contourf_reference.tex @@ -8,8 +8,10 @@ \definecolor{mediumseagreen68190112}{RGB}{68,190,112} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0, xmax=2, xtick style={color=black}, diff --git a/tests/test_custom_collection_reference.tex b/tests/test_custom_collection_reference.tex index a1399576..97517a46 100644 --- a/tests/test_custom_collection_reference.tex +++ b/tests/test_custom_collection_reference.tex @@ -5,8 +5,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-1.5, xmax=1.5, xtick style={color=black}, diff --git a/tests/test_datetime_paths_reference.tex b/tests/test_datetime_paths_reference.tex index 9c8e16d3..9ae28bb3 100644 --- a/tests/test_datetime_paths_reference.tex +++ b/tests/test_datetime_paths_reference.tex @@ -5,8 +5,10 @@ \begin{axis}[ date coordinates in=x, +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=2020-01-01 10:48, xmax=2020-01-02 13:12, xtick style={color=black}, diff --git a/tests/test_datetime_reference.tex b/tests/test_datetime_reference.tex index c5dcee65..2d4f7962 100644 --- a/tests/test_datetime_reference.tex +++ b/tests/test_datetime_reference.tex @@ -5,8 +5,10 @@ \begin{axis}[ date coordinates in=x, +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=2016-10-10 17:59, xmax=2016-10-10 18:15, xtick style={color=black}, diff --git a/tests/test_errorband_reference.tex b/tests/test_errorband_reference.tex index beb86fd9..00b94a2b 100644 --- a/tests/test_errorband_reference.tex +++ b/tests/test_errorband_reference.tex @@ -3,9 +3,11 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, title={Simple plot}, +width=6.4in, x grid style={darkgray176}, xlabel={t}, xmajorgrids, diff --git a/tests/test_errorbar_reference.tex b/tests/test_errorbar_reference.tex index ede805dc..2d36b971 100644 --- a/tests/test_errorbar_reference.tex +++ b/tests/test_errorbar_reference.tex @@ -4,8 +4,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=7.121, xmax=7.539, xtick style={color=black}, diff --git a/tests/test_escape_chars_reference.tex b/tests/test_escape_chars_reference.tex index d17ae848..336bfea6 100644 --- a/tests/test_escape_chars_reference.tex +++ b/tests/test_escape_chars_reference.tex @@ -3,9 +3,11 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, title={Foo \& Bar Dogs\_N\_Cats \%}, +width=6.4in, x grid style={darkgray176}, xlabel={Foo \& Bar Dogs\_N\_Cats \%}, xmin=-0.055, xmax=0.055, diff --git a/tests/test_externalize_tables_reference.tex b/tests/test_externalize_tables_reference.tex index b91a5021..3d19a24b 100644 --- a/tests/test_externalize_tables_reference.tex +++ b/tests/test_externalize_tables_reference.tex @@ -8,9 +8,11 @@ \begin{axis}[ axis background/.style={fill=gainsboro229}, axis line style={white}, +height=4.8in, tick align=outside, tick pos=left, title={Simple plot \(\displaystyle \frac{\alpha}{2}\)}, +width=6.4in, x grid style={white}, xlabel=\textcolor{dimgray85}{time(s)}, xmajorgrids, diff --git a/tests/test_fancy_colorbar_reference.tex b/tests/test_fancy_colorbar_reference.tex index 4cbad7a8..5f139717 100644 --- a/tests/test_fancy_colorbar_reference.tex +++ b/tests/test_fancy_colorbar_reference.tex @@ -6,10 +6,12 @@ colorbar, colorbar style={ylabel={}}, colormap/viridis, +height=4.8in, point meta max=1, point meta min=0, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.5, xmax=2.5, xtick style={color=black}, diff --git a/tests/test_fillstyle_reference.tex b/tests/test_fillstyle_reference.tex index 70c4797f..749847fd 100644 --- a/tests/test_fillstyle_reference.tex +++ b/tests/test_fillstyle_reference.tex @@ -4,8 +4,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.05, xmax=1.05, xtick style={color=black}, diff --git a/tests/test_heat_reference.tex b/tests/test_heat_reference.tex index c9fc15de..dfb45d87 100644 --- a/tests/test_heat_reference.tex +++ b/tests/test_heat_reference.tex @@ -6,10 +6,12 @@ colorbar, colorbar style={ylabel={}}, colormap/blackwhite, +height=4.8in, point meta max=100, point meta min=-100, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-10, xmax=10, xtick style={color=black}, diff --git a/tests/test_histogram_reference.tex b/tests/test_histogram_reference.tex index fbe56f80..a4367c6d 100644 --- a/tests/test_histogram_reference.tex +++ b/tests/test_histogram_reference.tex @@ -6,10 +6,12 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=lightgray204}, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=2.4365136, xmax=21.996362, xtick style={color=black}, diff --git a/tests/test_horizontal_alignment_reference.tex b/tests/test_horizontal_alignment_reference.tex index 9191c282..fff19436 100644 --- a/tests/test_horizontal_alignment_reference.tex +++ b/tests/test_horizontal_alignment_reference.tex @@ -4,8 +4,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.375, xmax=2.375, xtick style={color=black}, diff --git a/tests/test_image_plot_lower_reference.tex b/tests/test_image_plot_lower_reference.tex index 41d3215a..397de696 100644 --- a/tests/test_image_plot_lower_reference.tex +++ b/tests/test_image_plot_lower_reference.tex @@ -6,12 +6,14 @@ colorbar, colorbar style={ylabel={}}, colormap/viridis, +height=0.16in, hide x axis, hide y axis, point meta max=0.93333334, point meta min=0.10196079, tick align=outside, tick pos=left, +width=0.16in, x grid style={darkgray176}, xmin=-0.5, xmax=15.5, xtick style={color=black}, diff --git a/tests/test_image_plot_upper_reference.tex b/tests/test_image_plot_upper_reference.tex index 9d38818f..5e9c2b6e 100644 --- a/tests/test_image_plot_upper_reference.tex +++ b/tests/test_image_plot_upper_reference.tex @@ -6,12 +6,14 @@ colorbar, colorbar style={ylabel={}}, colormap/viridis, +height=0.16in, hide x axis, hide y axis, point meta max=0.93333334, point meta min=0.10196079, tick align=outside, tick pos=left, +width=0.16in, x grid style={darkgray176}, xmin=-0.5, xmax=15.5, xtick style={color=black}, diff --git a/tests/test_legend3_reference.tex b/tests/test_legend3_reference.tex index d7d531a9..085cfa9a 100644 --- a/tests/test_legend3_reference.tex +++ b/tests/test_legend3_reference.tex @@ -4,6 +4,7 @@ \definecolor{lightgray204}{RGB}{204,204,204} \begin{axis}[ +height=4in, legend cell align={left}, legend style={ fill opacity=0.8, @@ -15,6 +16,7 @@ }, tick align=outside, tick pos=left, +width=7in, x grid style={darkgray176}, xmajorgrids, xmin=0.95, xmax=2.05, diff --git a/tests/test_legend_columns_reference.tex b/tests/test_legend_columns_reference.tex index 83abb3ce..88c4bda4 100644 --- a/tests/test_legend_columns_reference.tex +++ b/tests/test_legend_columns_reference.tex @@ -6,6 +6,7 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=6in, legend cell align={left}, legend columns=2, legend style={ @@ -18,6 +19,7 @@ }, tick align=outside, tick pos=left, +width=17in, x grid style={darkgray176}, xmin=-0.05, xmax=1.05, xtick style={color=black}, diff --git a/tests/test_legend_labels_reference.tex b/tests/test_legend_labels_reference.tex index 03ffb5e6..2e56add6 100644 --- a/tests/test_legend_labels_reference.tex +++ b/tests/test_legend_labels_reference.tex @@ -7,10 +7,12 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=lightgray204}, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.3, xmax=6.3, xtick style={color=black}, diff --git a/tests/test_legend_line_scatter_reference.tex b/tests/test_legend_line_scatter_reference.tex index 8702df3a..cb47e1a5 100644 --- a/tests/test_legend_line_scatter_reference.tex +++ b/tests/test_legend_line_scatter_reference.tex @@ -5,6 +5,7 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={ fill opacity=0.8, @@ -16,6 +17,7 @@ }, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.2, xmax=4.2, xtick style={color=black}, diff --git a/tests/test_legends_reference.tex b/tests/test_legends_reference.tex index 61705792..a764150b 100644 --- a/tests/test_legends_reference.tex +++ b/tests/test_legends_reference.tex @@ -5,12 +5,14 @@ \definecolor{lightgray204}{RGB}{204,204,204} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=lightgray204}, tick align=outside, tick pos=left, title={Masked line demo}, unbounded coords=jump, +width=6.4in, x grid style={darkgray176}, xmin=-0.3, xmax=6.3, xtick style={color=black}, diff --git a/tests/test_line_collection_reference.tex b/tests/test_line_collection_reference.tex index 13fb499f..fdb4eaf4 100644 --- a/tests/test_line_collection_reference.tex +++ b/tests/test_line_collection_reference.tex @@ -7,11 +7,13 @@ colorbar, colorbar style={ylabel={Line Number}}, colormap/viridis, +height=4.8in, point meta max=9, point meta min=0, tick align=outside, tick pos=left, title={Line Collection with mapped colors}, +width=6.4in, x grid style={darkgray176}, xmin=0, xmax=9, xtick style={color=black}, diff --git a/tests/test_line_color_marker_reference.tex b/tests/test_line_color_marker_reference.tex index e999ebc8..1ab6ed42 100644 --- a/tests/test_line_color_marker_reference.tex +++ b/tests/test_line_color_marker_reference.tex @@ -8,9 +8,11 @@ \begin{axis}[ axis background/.style={fill=gainsboro229}, axis line style={white}, +height=4.8in, tick align=outside, tick pos=left, title={Simple plot \(\displaystyle \frac{\alpha}{2}\)}, +width=6.4in, x grid style={white}, xlabel=\textcolor{dimgray85}{time(s)}, xmajorgrids, diff --git a/tests/test_line_dashes_reference.tex b/tests/test_line_dashes_reference.tex index c7593656..9eabd5d7 100644 --- a/tests/test_line_dashes_reference.tex +++ b/tests/test_line_dashes_reference.tex @@ -10,8 +10,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.05, xmax=1.05, xtick style={color=black}, diff --git a/tests/test_line_set_data_reference.tex b/tests/test_line_set_data_reference.tex index 43956dae..ad95a090 100644 --- a/tests/test_line_set_data_reference.tex +++ b/tests/test_line_set_data_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.055, xmax=0.055, xtick style={color=black}, diff --git a/tests/test_loglogplot_reference.tex b/tests/test_loglogplot_reference.tex index 8aebeafc..752d697f 100644 --- a/tests/test_loglogplot_reference.tex +++ b/tests/test_loglogplot_reference.tex @@ -4,10 +4,12 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, log basis x={10}, log basis y={10}, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0.50118723, xmax=1995262.3, xmode=log, diff --git a/tests/test_logplot_base_reference.tex b/tests/test_logplot_base_reference.tex index e632add9..c24d9b31 100644 --- a/tests/test_logplot_base_reference.tex +++ b/tests/test_logplot_base_reference.tex @@ -3,9 +3,11 @@ \definecolor{green01270}{RGB}{0,127,0} \begin{axis}[ +height=4.8in, log basis y={2}, tick align=outside, tick pos=left, +width=6.4in, x grid style={green01270}, xmajorgrids, xmin=-0.45, xmax=9.45, diff --git a/tests/test_logplot_reference.tex b/tests/test_logplot_reference.tex index 8f5d1b8b..f2b9e589 100644 --- a/tests/test_logplot_reference.tex +++ b/tests/test_logplot_reference.tex @@ -3,9 +3,11 @@ \definecolor{green01270}{RGB}{0,127,0} \begin{axis}[ +height=4.8in, log basis y={10}, tick align=outside, tick pos=left, +width=6.4in, x grid style={green01270}, xmajorgrids, xmin=-0.45, xmax=9.45, diff --git a/tests/test_marker_reference.tex b/tests/test_marker_reference.tex index c9af3d38..12966189 100644 --- a/tests/test_marker_reference.tex +++ b/tests/test_marker_reference.tex @@ -3,9 +3,11 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, title={Simple plot}, +width=6.4in, x grid style={darkgray176}, xlabel={t}, xmajorgrids, diff --git a/tests/test_multi_line_title_reference.tex b/tests/test_multi_line_title_reference.tex index 86776952..bbaa90f7 100644 --- a/tests/test_multi_line_title_reference.tex +++ b/tests/test_multi_line_title_reference.tex @@ -4,6 +4,7 @@ \definecolor{lightgray204}{RGB}{204,204,204} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={ fill opacity=0.8, @@ -17,6 +18,7 @@ tick pos=left, title style={align=center}, title={Simple Sine Wave Plot\\With a Multi-line Title}, +width=6.4in, x grid style={darkgray176}, xlabel={Time (s)}, xmajorgrids, diff --git a/tests/test_noise2_reference.tex b/tests/test_noise2_reference.tex index ab6aa378..72c8d956 100644 --- a/tests/test_noise2_reference.tex +++ b/tests/test_noise2_reference.tex @@ -6,11 +6,13 @@ colorbar horizontal, colorbar style={xtick={-1,0,1},xticklabels={Low,Medium,{High,Higher}}}, colormap/viridis, +height=4.8in, point meta max=1, point meta min=-1, tick align=outside, tick pos=left, title={Gaussian noise with horizontal colorbar}, +width=6.4in, x grid style={darkgray176}, xmin=-0.5, xmax=249.5, xtick style={color=black}, diff --git a/tests/test_noise_reference.tex b/tests/test_noise_reference.tex index 2051dba1..418826d9 100644 --- a/tests/test_noise_reference.tex +++ b/tests/test_noise_reference.tex @@ -6,11 +6,13 @@ colorbar, colorbar style={ytick={-1,0,1},yticklabels={< -1,0,> 1},ylabel={}}, colormap/viridis, +height=4.8in, point meta max=1, point meta min=-1, tick align=outside, tick pos=left, title={Gaussian noise with vertical colorbar}, +width=6.4in, x grid style={darkgray176}, xmin=-0.5, xmax=249.5, xtick style={color=black}, diff --git a/tests/test_pandas_dataframe_reference.tex b/tests/test_pandas_dataframe_reference.tex index 2a9946ee..e3f5b1fd 100644 --- a/tests/test_pandas_dataframe_reference.tex +++ b/tests/test_pandas_dataframe_reference.tex @@ -4,8 +4,10 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=5in, tick align=outside, tick pos=left, +width=8in, x grid style={darkgray176}, xmin=-0.1, xmax=2.1, xtick style={color=black}, diff --git a/tests/test_patch_styles_reference.tex b/tests/test_patch_styles_reference.tex index cb7354f9..cd15871d 100644 --- a/tests/test_patch_styles_reference.tex +++ b/tests/test_patch_styles_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0.5, xmax=2.5, xtick style={color=black}, diff --git a/tests/test_patches_reference.tex b/tests/test_patches_reference.tex index 13447fc2..85aad57e 100644 --- a/tests/test_patches_reference.tex +++ b/tests/test_patches_reference.tex @@ -21,10 +21,12 @@ colorbar, colorbar style={ylabel={}}, colormap/viridis, +height=4.8in, point meta max=76.496365, point meta min=0.31811093, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0, xmax=1, xtick style={color=black}, diff --git a/tests/test_scatter_colormap_reference.tex b/tests/test_scatter_colormap_reference.tex index 1b7bd50c..5ec4ccaa 100644 --- a/tests/test_scatter_colormap_reference.tex +++ b/tests/test_scatter_colormap_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-1.1029737, xmax=1.4017776, xtick style={color=black}, diff --git a/tests/test_scatter_different_colors_reference.tex b/tests/test_scatter_different_colors_reference.tex index 55ed752b..147635b3 100644 --- a/tests/test_scatter_different_colors_reference.tex +++ b/tests/test_scatter_different_colors_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0.022394477, xmax=0.71377841, xtick style={color=black}, diff --git a/tests/test_scatter_different_sizes_reference.tex b/tests/test_scatter_different_sizes_reference.tex index 0ad33694..a684ab33 100644 --- a/tests/test_scatter_different_sizes_reference.tex +++ b/tests/test_scatter_different_sizes_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0.9, xmax=3.1, xtick style={color=black}, diff --git a/tests/test_scatter_reference.tex b/tests/test_scatter_reference.tex index be48c9b2..ae1c7d0a 100644 --- a/tests/test_scatter_reference.tex +++ b/tests/test_scatter_reference.tex @@ -7,8 +7,10 @@ \begin{axis}[ axis background/.style={fill=whitesmoke240}, axis line style={whitesmoke240}, +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={lightgray203}, xmajorgrids, xmin=-5, xmax=105, diff --git a/tests/test_steps_reference.tex b/tests/test_steps_reference.tex index ec224792..ae58524f 100644 --- a/tests/test_steps_reference.tex +++ b/tests/test_steps_reference.tex @@ -7,6 +7,7 @@ \definecolor{lightgray204}{RGB}{204,204,204} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={ fill opacity=0.8, @@ -18,6 +19,7 @@ }, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.2, xmax=4.2, xtick style={color=black}, diff --git a/tests/test_text_overlay_reference.tex b/tests/test_text_overlay_reference.tex index 47d95c7e..718a433f 100644 --- a/tests/test_text_overlay_reference.tex +++ b/tests/test_text_overlay_reference.tex @@ -7,6 +7,7 @@ \definecolor{steelblue31119180}{RGB}{31,119,180} \begin{axis}[ +height=4.8in, legend cell align={left}, legend style={ fill opacity=0.8, @@ -18,6 +19,7 @@ }, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=-0.25, xmax=5.25, xtick style={color=black}, diff --git a/tests/test_viridis_reference.tex b/tests/test_viridis_reference.tex index a4f7aa49..8b1de096 100644 --- a/tests/test_viridis_reference.tex +++ b/tests/test_viridis_reference.tex @@ -3,8 +3,10 @@ \definecolor{darkgray176}{RGB}{176,176,176} \begin{axis}[ +height=4.8in, tick align=outside, tick pos=left, +width=6.4in, x grid style={darkgray176}, xmin=0, xmax=1, xtick style={color=black}, From e2e8cc327a6edf6a2c680d532721380676e74e46 Mon Sep 17 00:00:00 2001 From: Faisal Date: Mon, 9 Feb 2026 19:32:17 -0500 Subject: [PATCH 5/9] Fixed inverted axes issue with clean_figure. Passes all tests --- src/matplot2tikz/_cleanfigure.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/matplot2tikz/_cleanfigure.py b/src/matplot2tikz/_cleanfigure.py index 4f578ebd..25a06994 100644 --- a/src/matplot2tikz/_cleanfigure.py +++ b/src/matplot2tikz/_cleanfigure.py @@ -390,8 +390,15 @@ def _remove_nans(data: np.ndarray) -> np.ndarray: return np.delete(data, id_remove, axis=0) +def _sorted_limits(lim: np.ndarray) -> np.ndarray: + """Return axis limits as [min, max] regardless of axis direction.""" + return np.array([np.min(lim), np.max(lim)]) + + def _is_in_box(data: np.ndarray, x_lim: np.ndarray, y_lim: np.ndarray) -> np.ndarray: """Returns a mask that indicates, whether a data point is within the limits.""" + x_lim = _sorted_limits(x_lim) + y_lim = _sorted_limits(y_lim) mask_x = np.logical_and(data[:, 0] > x_lim[0], data[:, 0] < x_lim[1]) mask_y = np.logical_and(data[:, 1] > y_lim[0], data[:, 1] < y_lim[1]) return np.logical_and(mask_x, mask_y) @@ -545,14 +552,15 @@ def _move_points_closer(y_lim: np.ndarray, data: np.ndarray) -> np.ndarray: # Calculate the extension of the extended box # (x_width not important for clipping, as it is already dealt with elsewhere (maybe by # matplotlib when lim() occurs)) - y_width = y_lim[1] - y_lim[0] + y_min, y_max = _sorted_limits(y_lim) + y_width = y_max - y_min # Don't choose the larger box too large to make sure that the values inside # it can still be treated by TeX. extended_factor = 0.1 - y_min_ext = y_lim[0] - extended_factor * y_width - y_max_ext = y_lim[1] + extended_factor * y_width + y_min_ext = y_min - extended_factor * y_width + y_max_ext = y_max + extended_factor * y_width # Copy data to avoid modifying original array clipped_data = np.array(data, copy=True) @@ -607,8 +615,8 @@ def _simplify_line(cfd: CleanFigureData) -> np.ndarray: # Automatically guess a tol based on the area of the figure and # the area and resolution of the output - x_range = cfd.x_lim[1] - cfd.x_lim[0] - y_range = cfd.y_lim[1] - cfd.y_lim[0] + x_range = np.max(cfd.x_lim) - np.min(cfd.x_lim) + y_range = np.max(cfd.y_lim) - np.min(cfd.y_lim) # Conversion factors of data units into pixels x_to_pix = width / x_range @@ -893,6 +901,8 @@ def _corners2d( x_lim: np.ndarray, y_lim: np.ndarray ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: """Determine the corners of the axes as defined by xLim and yLim.""" + x_lim = _sorted_limits(x_lim) + y_lim = _sorted_limits(y_lim) bottom_left = np.array([x_lim[0], y_lim[0]]) top_left = np.array([x_lim[0], y_lim[1]]) bottom_right = np.array([x_lim[1], y_lim[0]]) @@ -904,6 +914,9 @@ def _corners3d( x_lim: list | np.ndarray, y_lim: list | np.ndarray, z_lim: list | np.ndarray ) -> np.ndarray: """Determine the corners of the 3D axes as defined by xLim, yLim and zLim.""" + x_lim = _sorted_limits(np.array(x_lim)) + y_lim = _sorted_limits(np.array(y_lim)) + z_lim = _sorted_limits(np.array(z_lim)) # Lower square of the cube lower_bottom_left = np.array([x_lim[0], y_lim[0], z_lim[0]]) lower_top_left = np.array([x_lim[0], y_lim[1], z_lim[0]]) From c04b4cbba53e618e6e7a4540f95766d6b7390617 Mon Sep 17 00:00:00 2001 From: Sebastian Ting Date: Mon, 9 Feb 2026 23:04:36 -0500 Subject: [PATCH 6/9] fixed gradient #93, #586 --- src/matplot2tikz/_line2d.py | 2 + tests/test_line_collection_reference.tex | 31 ++-- .../test_line_collection_reference_output.tex | 155 ++++++++++++++++++ 3 files changed, 177 insertions(+), 11 deletions(-) create mode 100644 tests/test_line_collection_reference_output.tex diff --git a/src/matplot2tikz/_line2d.py b/src/matplot2tikz/_line2d.py index 7f675451..6a34ee98 100644 --- a/src/matplot2tikz/_line2d.py +++ b/src/matplot2tikz/_line2d.py @@ -166,6 +166,8 @@ def draw_linecollection(data: TikzData, obj: LineCollection) -> list[str]: """Returns Pgfplots code for a number of patch objects.""" content = [] + obj.update_scalarmappable() + edgecolors = obj.get_edgecolors() # type: ignore[attr-defined] linestyles = obj.get_linestyles() # type: ignore[attr-defined] linewidths = obj.get_linewidths() # type: ignore[attr-defined] diff --git a/tests/test_line_collection_reference.tex b/tests/test_line_collection_reference.tex index fdb4eaf4..0d405e7a 100644 --- a/tests/test_line_collection_reference.tex +++ b/tests/test_line_collection_reference.tex @@ -1,7 +1,16 @@ \begin{tikzpicture} +\definecolor{darkcyan30157136}{RGB}{30,157,136} +\definecolor{darkcyan37130142}{RGB}{37,130,142} \definecolor{darkgray176}{RGB}{176,176,176} -\definecolor{steelblue31119180}{RGB}{31,119,180} +\definecolor{darkslateblue48103141}{RGB}{48,103,141} +\definecolor{darkslateblue6273137}{RGB}{62,73,137} +\definecolor{darkslateblue7139119}{RGB}{71,39,119} +\definecolor{gold25323136}{RGB}{253,231,36} +\definecolor{indigo68184}{RGB}{68,1,84} +\definecolor{mediumseagreen53183120}{RGB}{53,183,120} +\definecolor{yellowgreen10920688}{RGB}{109,206,88} +\definecolor{yellowgreen18122143}{RGB}{181,221,43} \begin{axis}[ colorbar, @@ -21,7 +30,7 @@ ymin=0, ymax=18, ytick style={color=black} ] -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=indigo68184, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,0) --(axis cs:1,1) --(axis cs:2,2) @@ -33,7 +42,7 @@ --(axis cs:8,8) --(axis cs:9,9); -\path [draw=steelblue31119180, dash pattern=on 6.4pt off 1.6pt on 1pt off 1.6pt] +\path [draw=darkslateblue7139119, dash pattern=on 6.4pt off 1.6pt on 1pt off 1.6pt] (axis cs:0,1) --(axis cs:1,2) --(axis cs:2,3) @@ -45,7 +54,7 @@ --(axis cs:8,9) --(axis cs:9,10); -\path [draw=steelblue31119180, semithick, dash pattern=on 9.6pt off 2.4pt on 1.5pt off 2.4pt] +\path [draw=darkslateblue6273137, semithick, dash pattern=on 9.6pt off 2.4pt on 1.5pt off 2.4pt] (axis cs:0,2) --(axis cs:1,3) --(axis cs:2,4) @@ -57,7 +66,7 @@ --(axis cs:8,10) --(axis cs:9,11); -\path [draw=steelblue31119180, thick, dash pattern=on 12.8pt off 3.2pt on 2pt off 3.2pt] +\path [draw=darkslateblue48103141, thick, dash pattern=on 12.8pt off 3.2pt on 2pt off 3.2pt] (axis cs:0,3) --(axis cs:1,4) --(axis cs:2,5) @@ -69,7 +78,7 @@ --(axis cs:8,11) --(axis cs:9,12); -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=darkcyan37130142, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,4) --(axis cs:1,5) --(axis cs:2,6) @@ -81,7 +90,7 @@ --(axis cs:8,12) --(axis cs:9,13); -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=darkcyan30157136, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,5) --(axis cs:1,6) --(axis cs:2,7) @@ -93,7 +102,7 @@ --(axis cs:8,13) --(axis cs:9,14); -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=mediumseagreen53183120, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,6) --(axis cs:1,7) --(axis cs:2,8) @@ -105,7 +114,7 @@ --(axis cs:8,14) --(axis cs:9,15); -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=yellowgreen10920688, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,7) --(axis cs:1,8) --(axis cs:2,9) @@ -117,7 +126,7 @@ --(axis cs:8,15) --(axis cs:9,16); -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=yellowgreen18122143, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,8) --(axis cs:1,9) --(axis cs:2,10) @@ -129,7 +138,7 @@ --(axis cs:8,16) --(axis cs:9,17); -\path [draw=steelblue31119180, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +\path [draw=gold25323136, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] (axis cs:0,9) --(axis cs:1,10) --(axis cs:2,11) diff --git a/tests/test_line_collection_reference_output.tex b/tests/test_line_collection_reference_output.tex new file mode 100644 index 00000000..0d405e7a --- /dev/null +++ b/tests/test_line_collection_reference_output.tex @@ -0,0 +1,155 @@ +\begin{tikzpicture} + +\definecolor{darkcyan30157136}{RGB}{30,157,136} +\definecolor{darkcyan37130142}{RGB}{37,130,142} +\definecolor{darkgray176}{RGB}{176,176,176} +\definecolor{darkslateblue48103141}{RGB}{48,103,141} +\definecolor{darkslateblue6273137}{RGB}{62,73,137} +\definecolor{darkslateblue7139119}{RGB}{71,39,119} +\definecolor{gold25323136}{RGB}{253,231,36} +\definecolor{indigo68184}{RGB}{68,1,84} +\definecolor{mediumseagreen53183120}{RGB}{53,183,120} +\definecolor{yellowgreen10920688}{RGB}{109,206,88} +\definecolor{yellowgreen18122143}{RGB}{181,221,43} + +\begin{axis}[ +colorbar, +colorbar style={ylabel={Line Number}}, +colormap/viridis, +height=4.8in, +point meta max=9, +point meta min=0, +tick align=outside, +tick pos=left, +title={Line Collection with mapped colors}, +width=6.4in, +x grid style={darkgray176}, +xmin=0, xmax=9, +xtick style={color=black}, +y grid style={darkgray176}, +ymin=0, ymax=18, +ytick style={color=black} +] +\path [draw=indigo68184, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,0) +--(axis cs:1,1) +--(axis cs:2,2) +--(axis cs:3,3) +--(axis cs:4,4) +--(axis cs:5,5) +--(axis cs:6,6) +--(axis cs:7,7) +--(axis cs:8,8) +--(axis cs:9,9); + +\path [draw=darkslateblue7139119, dash pattern=on 6.4pt off 1.6pt on 1pt off 1.6pt] +(axis cs:0,1) +--(axis cs:1,2) +--(axis cs:2,3) +--(axis cs:3,4) +--(axis cs:4,5) +--(axis cs:5,6) +--(axis cs:6,7) +--(axis cs:7,8) +--(axis cs:8,9) +--(axis cs:9,10); + +\path [draw=darkslateblue6273137, semithick, dash pattern=on 9.6pt off 2.4pt on 1.5pt off 2.4pt] +(axis cs:0,2) +--(axis cs:1,3) +--(axis cs:2,4) +--(axis cs:3,5) +--(axis cs:4,6) +--(axis cs:5,7) +--(axis cs:6,8) +--(axis cs:7,9) +--(axis cs:8,10) +--(axis cs:9,11); + +\path [draw=darkslateblue48103141, thick, dash pattern=on 12.8pt off 3.2pt on 2pt off 3.2pt] +(axis cs:0,3) +--(axis cs:1,4) +--(axis cs:2,5) +--(axis cs:3,6) +--(axis cs:4,7) +--(axis cs:5,8) +--(axis cs:6,9) +--(axis cs:7,10) +--(axis cs:8,11) +--(axis cs:9,12); + +\path [draw=darkcyan37130142, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,4) +--(axis cs:1,5) +--(axis cs:2,6) +--(axis cs:3,7) +--(axis cs:4,8) +--(axis cs:5,9) +--(axis cs:6,10) +--(axis cs:7,11) +--(axis cs:8,12) +--(axis cs:9,13); + +\path [draw=darkcyan30157136, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,5) +--(axis cs:1,6) +--(axis cs:2,7) +--(axis cs:3,8) +--(axis cs:4,9) +--(axis cs:5,10) +--(axis cs:6,11) +--(axis cs:7,12) +--(axis cs:8,13) +--(axis cs:9,14); + +\path [draw=mediumseagreen53183120, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,6) +--(axis cs:1,7) +--(axis cs:2,8) +--(axis cs:3,9) +--(axis cs:4,10) +--(axis cs:5,11) +--(axis cs:6,12) +--(axis cs:7,13) +--(axis cs:8,14) +--(axis cs:9,15); + +\path [draw=yellowgreen10920688, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,7) +--(axis cs:1,8) +--(axis cs:2,9) +--(axis cs:3,10) +--(axis cs:4,11) +--(axis cs:5,12) +--(axis cs:6,13) +--(axis cs:7,14) +--(axis cs:8,15) +--(axis cs:9,16); + +\path [draw=yellowgreen18122143, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,8) +--(axis cs:1,9) +--(axis cs:2,10) +--(axis cs:3,11) +--(axis cs:4,12) +--(axis cs:5,13) +--(axis cs:6,14) +--(axis cs:7,15) +--(axis cs:8,16) +--(axis cs:9,17); + +\path [draw=gold25323136, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] +(axis cs:0,9) +--(axis cs:1,10) +--(axis cs:2,11) +--(axis cs:3,12) +--(axis cs:4,13) +--(axis cs:5,14) +--(axis cs:6,15) +--(axis cs:7,16) +--(axis cs:8,17) +--(axis cs:9,18); + +\end{axis} + +\end{tikzpicture} From 0efd9d6c99eeb14c803fc1a931d60e14a08940c4 Mon Sep 17 00:00:00 2001 From: Alex <107329684+AlexChrzanowski@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:09:36 -0500 Subject: [PATCH 7/9] Delete tests/test_line_collection_reference_output.tex --- .../test_line_collection_reference_output.tex | 155 ------------------ 1 file changed, 155 deletions(-) delete mode 100644 tests/test_line_collection_reference_output.tex diff --git a/tests/test_line_collection_reference_output.tex b/tests/test_line_collection_reference_output.tex deleted file mode 100644 index 0d405e7a..00000000 --- a/tests/test_line_collection_reference_output.tex +++ /dev/null @@ -1,155 +0,0 @@ -\begin{tikzpicture} - -\definecolor{darkcyan30157136}{RGB}{30,157,136} -\definecolor{darkcyan37130142}{RGB}{37,130,142} -\definecolor{darkgray176}{RGB}{176,176,176} -\definecolor{darkslateblue48103141}{RGB}{48,103,141} -\definecolor{darkslateblue6273137}{RGB}{62,73,137} -\definecolor{darkslateblue7139119}{RGB}{71,39,119} -\definecolor{gold25323136}{RGB}{253,231,36} -\definecolor{indigo68184}{RGB}{68,1,84} -\definecolor{mediumseagreen53183120}{RGB}{53,183,120} -\definecolor{yellowgreen10920688}{RGB}{109,206,88} -\definecolor{yellowgreen18122143}{RGB}{181,221,43} - -\begin{axis}[ -colorbar, -colorbar style={ylabel={Line Number}}, -colormap/viridis, -height=4.8in, -point meta max=9, -point meta min=0, -tick align=outside, -tick pos=left, -title={Line Collection with mapped colors}, -width=6.4in, -x grid style={darkgray176}, -xmin=0, xmax=9, -xtick style={color=black}, -y grid style={darkgray176}, -ymin=0, ymax=18, -ytick style={color=black} -] -\path [draw=indigo68184, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,0) ---(axis cs:1,1) ---(axis cs:2,2) ---(axis cs:3,3) ---(axis cs:4,4) ---(axis cs:5,5) ---(axis cs:6,6) ---(axis cs:7,7) ---(axis cs:8,8) ---(axis cs:9,9); - -\path [draw=darkslateblue7139119, dash pattern=on 6.4pt off 1.6pt on 1pt off 1.6pt] -(axis cs:0,1) ---(axis cs:1,2) ---(axis cs:2,3) ---(axis cs:3,4) ---(axis cs:4,5) ---(axis cs:5,6) ---(axis cs:6,7) ---(axis cs:7,8) ---(axis cs:8,9) ---(axis cs:9,10); - -\path [draw=darkslateblue6273137, semithick, dash pattern=on 9.6pt off 2.4pt on 1.5pt off 2.4pt] -(axis cs:0,2) ---(axis cs:1,3) ---(axis cs:2,4) ---(axis cs:3,5) ---(axis cs:4,6) ---(axis cs:5,7) ---(axis cs:6,8) ---(axis cs:7,9) ---(axis cs:8,10) ---(axis cs:9,11); - -\path [draw=darkslateblue48103141, thick, dash pattern=on 12.8pt off 3.2pt on 2pt off 3.2pt] -(axis cs:0,3) ---(axis cs:1,4) ---(axis cs:2,5) ---(axis cs:3,6) ---(axis cs:4,7) ---(axis cs:5,8) ---(axis cs:6,9) ---(axis cs:7,10) ---(axis cs:8,11) ---(axis cs:9,12); - -\path [draw=darkcyan37130142, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,4) ---(axis cs:1,5) ---(axis cs:2,6) ---(axis cs:3,7) ---(axis cs:4,8) ---(axis cs:5,9) ---(axis cs:6,10) ---(axis cs:7,11) ---(axis cs:8,12) ---(axis cs:9,13); - -\path [draw=darkcyan30157136, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,5) ---(axis cs:1,6) ---(axis cs:2,7) ---(axis cs:3,8) ---(axis cs:4,9) ---(axis cs:5,10) ---(axis cs:6,11) ---(axis cs:7,12) ---(axis cs:8,13) ---(axis cs:9,14); - -\path [draw=mediumseagreen53183120, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,6) ---(axis cs:1,7) ---(axis cs:2,8) ---(axis cs:3,9) ---(axis cs:4,10) ---(axis cs:5,11) ---(axis cs:6,12) ---(axis cs:7,13) ---(axis cs:8,14) ---(axis cs:9,15); - -\path [draw=yellowgreen10920688, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,7) ---(axis cs:1,8) ---(axis cs:2,9) ---(axis cs:3,10) ---(axis cs:4,11) ---(axis cs:5,12) ---(axis cs:6,13) ---(axis cs:7,14) ---(axis cs:8,15) ---(axis cs:9,16); - -\path [draw=yellowgreen18122143, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,8) ---(axis cs:1,9) ---(axis cs:2,10) ---(axis cs:3,11) ---(axis cs:4,12) ---(axis cs:5,13) ---(axis cs:6,14) ---(axis cs:7,15) ---(axis cs:8,16) ---(axis cs:9,17); - -\path [draw=gold25323136, very thin, dash pattern=on 3.2pt off 0.8pt on 0.5pt off 0.8pt] -(axis cs:0,9) ---(axis cs:1,10) ---(axis cs:2,11) ---(axis cs:3,12) ---(axis cs:4,13) ---(axis cs:5,14) ---(axis cs:6,15) ---(axis cs:7,16) ---(axis cs:8,17) ---(axis cs:9,18); - -\end{axis} - -\end{tikzpicture} From 28f8f2feef8fff3c2402b2f64fecee7e1a13a079 Mon Sep 17 00:00:00 2001 From: Alex <107329684+AlexChrzanowski@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:38:04 -0500 Subject: [PATCH 8/9] Refactor plot function in test_tick_positions.py Refactor plot function to improve tick parameter handling and figure size. --- tests/test_tick_positions.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_tick_positions.py b/tests/test_tick_positions.py index 92ba524d..c1626700 100644 --- a/tests/test_tick_positions.py +++ b/tests/test_tick_positions.py @@ -14,14 +14,20 @@ def plot() -> Figure: x = [1, 2, 3, 4] y = [1, 4, 9, 6] - - fig = plt.figure() - for i, (bottom, top, left, right) in enumerate(itertools.product(["off", "on"], repeat=4)): - plt.subplot(4, 4, i + 1) + + fig = plt.figure(figsize=(10, 10)) + + # repeat=4 gives 16 combinations of (bottom, top, left, right) + for i, (b, t, l, r) in enumerate(itertools.product([False, True], repeat=4)): + ax = plt.subplot(4, 4, i + 1) plt.plot(x, y, "ro") - plt.tick_params(axis="x", which="both", bottom=bottom, top=top) - plt.tick_params(axis="y", which="both", left=left, right=right) + + # Set the visibility of the tick lines + # We also turn off the labels so the plots don't overlap + ax.tick_params(axis="x", which="both", bottom=b, top=t, labelbottom=False) + ax.tick_params(axis="y", which="both", left=l, right=r, labelleft=False) + plt.tight_layout() return fig From e2a6c01ab480baa37e411f4834fbd62abd83dad1 Mon Sep 17 00:00:00 2001 From: Alex <107329684+AlexChrzanowski@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:46:25 -0500 Subject: [PATCH 9/9] Adjust tick positions and styles in group plots --- tests/test_tick_positions_reference.tex | 141 +++++++++++++++++------- 1 file changed, 101 insertions(+), 40 deletions(-) diff --git a/tests/test_tick_positions_reference.tex b/tests/test_tick_positions_reference.tex index 48d9554d..55b50f83 100644 --- a/tests/test_tick_positions_reference.tex +++ b/tests/test_tick_positions_reference.tex @@ -4,15 +4,19 @@ \begin{groupplot}[group style={group size=4 by 4}] \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -23,15 +27,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=right, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -42,15 +50,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=left, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -61,15 +73,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=both, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -80,15 +96,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=right, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -99,15 +119,18 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, +tick pos=right, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -118,15 +141,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=right, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=left, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -137,15 +164,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=right, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=both, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -156,15 +187,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=left, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -175,15 +210,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=left, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=right, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -194,15 +233,18 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, +tick pos=left, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -213,15 +255,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=left, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=both, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -232,15 +278,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=both, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -251,15 +301,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=both, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=right, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -270,15 +324,19 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, +xtick pos=both, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick pos=left, +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {% @@ -289,15 +347,18 @@ }; \nextgroupplot[ +scaled x ticks=manual:{}{\pgfmathparse{#1}}, +scaled y ticks=manual:{}{\pgfmathparse{#1}}, tick align=outside, +tick pos=both, x grid style={darkgray176}, -xmajorticks=false, xmin=0.85, xmax=4.15, xtick style={color=black}, +xticklabels={}, y grid style={darkgray176}, -ymajorticks=false, ymin=0.6, ymax=9.4, -ytick style={color=black} +ytick style={color=black}, +yticklabels={} ] \addplot [semithick, red, mark=*, mark size=3, mark options={solid}, only marks] table {%