Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch plot shader interp issue #471

Open
lucafadigati opened this issue Feb 23, 2024 · 2 comments
Open

patch plot shader interp issue #471

lucafadigati opened this issue Feb 23, 2024 · 2 comments
Labels

Comments

@lucafadigati
Copy link

lucafadigati commented Feb 23, 2024

Hi,
I need to plot a velocity magnitude distribution over a 2D triangular mesh, hence I have used patch plot as follows using the jet colormap. I used the shader=interp to have a smooth color variation over the domain but there is an issue in the color interpolation because there are some "darker edges" in the picture as shown in the attached image.
Using shader=flat, everything is fine.
Is it an issue of the Gouraud shading?

Best regards,
Luca

Screenshot from 2024-02-23 13-49-31

\begin{tikzpicture}[font=\small, scale=0.9]

\begin{axis}[
    every axis/.append style={font=\normalsize},
    hide axis,
    scale only axis,
    axis equal image,
    colorbar horizontal,
    colormap/jet,
    point meta min=0,
    point meta max=2300,
]

    \addplot [
    patch,
    shader=interp,
    patch table with individual point meta={tri.dat}
    ]
    table
    {points.dat};

\end{axis}

\end{tikzpicture}
@muzimuzhi
Copy link
Member

Please make your example complete, so others could typeset and dig into it.

  • missing \documentclass, etc.
  • no points.dat (could just be a sample)

@lucafadigati
Copy link
Author

lucafadigati commented Feb 23, 2024

In the uploaded the following tex file which contains a minimal working example which creates a figure that highlights the issue. To avoid too long execution time, I have plot only the region that has the problem.

Zooming in the output pdf file, the "bad colored" triangle are visible between the cyan and yellow region. These triangles seem to have a darker edge and a lighter ones.

example.zip

\documentclass[a4paper]{standalone}

\usepackage{tikz, tikz-3dplot}
\usepackage{pgfplotstable}
\usepackage{pgfplots}

\usetikzlibrary{positioning,calc,tikzmark,patterns,patterns.meta,decorations,decorations.text,decorations.pathmorphing,backgrounds,math}

\begin{document}

\begin{tikzpicture}[font=\small, scale=0.9]

    \begin{axis}[
        every axis/.append style={font=\normalsize},
        hide axis,
        scale only axis,
        axis equal image,
        xmin=0.28, xmax=0.4,
        ymin=0, ymax=0.05,
        colorbar horizontal,
        colormap/jet,
        point meta min=0,
        point meta max=2300,
        colorbar style={
           at={(0,1.3)},anchor=south west,
           height=0.4cm,
           title=$u$,
           font = \normalsize,
        }
    ]
    
        \addplot [
        patch,
        shader=interp,
        patch table with individual point meta={Umag_tri_.dat}
        ]
        table
        {points_.dat};
    
    \end{axis}
    \end{tikzpicture}
   
\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants