You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pcolormesh: Artifacts compared to pure Matplotlib? #136
For context, in the source i can see that there is an edgefix applies particularly to pcolormesh which is don't fully comprehend why this is. Maybe it's related. I will have time to look into this after next week. PR is always welcome!
I meant the fact that the pixels are not square in the ultraplot case. Now, I realize that also on the left side near the black axis line, the pixels seem to be cut. What else do you see? And, most important: Can you reproduce this? I used a clean environement with only ultraplot, numpy, jupyter and matplotlib.
I see that the edges of the squares are the same colour as the inside of the square creating a round illusion. Furthermore the black bar is still visible as if it is on top of the axes.
Yes, this is the issue I mentioned earlier. When going through the code I didn't really understand why this part is in there. I don't have access to a computer at the moment so will need to judge if this can be removed as it was an issue on older versions. I don't use pcolormesh too often and rely on imshow more so perhaps this occurs with non regular meshes?
There is a function (perhaps private) that "fixes" the edges that is called on quad meshes (of which pcolormesh is one). I can't recall exactly why this function exists. I would need to have some coffee and a computer to evaluate the existence of this function.
Not really happy with this behavior, and more leaning towards having it off and then turning it on when exporting the file to another format, however this may be a bit tricky to implement as the plot was already generated. Will have a closer look.
Ok so I am a bit of two minds on this. On the one end, this artifact is not wanted when you are doing some exploratory data analysis. On the other end the issue generated through visual artifacts is fixed by ultraplot but is not caused by matplotlib or ultraplot but by a potential pdf viewer. In both cases, I am leaning towards turning this feature off by default and only turn it on when explicitly set. What do you think @Ockenfuss?
Actually, I don't think this a good idea. See #147 for motivation. Closing this issue, the artifacts can be suppressed in EDA context with the parameter edgefix = False or setting ultraplot.rc["edgefix"] = False.
Activity
cvanelteren commentedon Apr 2, 2025
I see two artefacts in this plot, which one are you referring to specifically?
cvanelteren commentedon Apr 3, 2025
For context, in the source i can see that there is an edgefix applies particularly to pcolormesh which is don't fully comprehend why this is. Maybe it's related. I will have time to look into this after next week. PR is always welcome!
Ockenfuss commentedon Apr 3, 2025
I meant the fact that the pixels are not square in the ultraplot case. Now, I realize that also on the left side near the black axis line, the pixels seem to be cut. What else do you see? And, most important: Can you reproduce this? I used a clean environement with only ultraplot, numpy, jupyter and matplotlib.
Ockenfuss commentedon Apr 3, 2025
I am not familiar with the ultraplot codebase, but I will see if I find some time over the weekend to track this down further!
cvanelteren commentedon Apr 3, 2025
I see that the edges of the squares are the same colour as the inside of the square creating a round illusion. Furthermore the black bar is still visible as if it is on top of the axes.
cvanelteren commentedon Apr 3, 2025
The first is related to the issue I mentioned above. The second dunno.
cvanelteren commentedon Apr 3, 2025
Ah wait it's the grid major. That's what I am seeing.
Ockenfuss commentedon Apr 3, 2025
Yes, the black line is just the grid. I experimented a little and found that the issue with the squares vanishes if I set "edgefix=False".
cvanelteren commentedon Apr 3, 2025
Yes, this is the issue I mentioned earlier. When going through the code I didn't really understand why this part is in there. I don't have access to a computer at the moment so will need to judge if this can be removed as it was an issue on older versions. I don't use pcolormesh too often and rely on imshow more so perhaps this occurs with non regular meshes?
Ockenfuss commentedon Apr 3, 2025
Ha, then thank you even more for the quick answers! It seems I am not the first one to discover this artifact: proplot-dev/proplot#455
cvanelteren commentedon Apr 3, 2025
There is a function (perhaps private) that "fixes" the edges that is called on quad meshes (of which pcolormesh is one). I can't recall exactly why this function exists. I would need to have some coffee and a computer to evaluate the existence of this function.
cvanelteren commentedon Apr 6, 2025
Ok had a look at this. The reason seems to be given in the docs https://ultraplot.readthedocs.io/en/latest/api/ultraplot.axes.PlotAxes.html#ultraplot.axes.PlotAxes.pcolormesh. There is an issue with non-pdf and svg exports with mpl that produces visual artifacts, see https://github.com/jklymak/contourfIssues. As ultraplot by default exports to pdf (without giving an extension directly) it is turned on by default.
Not really happy with this behavior, and more leaning towards having it off and then turning it on when exporting the file to another format, however this may be a bit tricky to implement as the plot was already generated. Will have a closer look.
cvanelteren commentedon Apr 7, 2025
Ok so I am a bit of two minds on this. On the one end, this artifact is not wanted when you are doing some exploratory data analysis. On the other end the issue generated through visual artifacts is fixed by ultraplot but is not caused by matplotlib or ultraplot but by a potential pdf viewer. In both cases, I am leaning towards turning this feature off by default and only turn it on when explicitly set. What do you think @Ockenfuss?
cvanelteren commentedon Apr 7, 2025
Actually, I don't think this a good idea. See #147 for motivation. Closing this issue, the artifacts can be suppressed in EDA context with the parameter
edgefix = Falseor settingultraplot.rc["edgefix"] = False.