I have a region and a contour plot. My goal is to superimpose them to compare them. So, I used the Opacity[] on the region plot function but when I save the figure in .pdf or .eps format, the result is not how I expect, as you can see below. The meshgrid somehow is also visible!

In Mathematica notebook's output I do not see this meshgrid, but it is visible only when I save the figure in as .pdf or .eps formats. I have tried using the function Mesh->None, it does not work. I must use the Opacity[] function because I am trying to superimpose two figures. Is there any way to not show the meshgrid?

I have read similar questions here about meshgrid showing up in region plots but none of them talk about superimposing two figures. So, I don't think it should be counted as a duplicate. One of them suggested to change the meshgrid colour to the same as the color that that region has after the opacity applied but that wouldn't work if I am superimposing figures.

My code:

Here I define the functions that are plotted in the figures.

u[\[Alpha]_, \[CapitalPhi]_, \[Kappa]_] := \[Alpha] - \[Kappa] Cos[\
q[\[Alpha]_, \[CapitalPhi]_, \[Kappa]_] := 
 2 \[Alpha]^3 + 18 \[Alpha] (\[Kappa] Sin[\[CapitalPhi]])^2 - 
  27 \[Kappa]^2 u[\[Alpha], \[CapitalPhi], \[Kappa]]
p[\[Alpha]_, \[CapitalPhi]_, \[Kappa]_] := \[Alpha]^2 - 
  3 (\[Kappa] Sin[\[CapitalPhi]])^2
A[\[Alpha]_, \[CapitalPhi]_, \[Kappa]_] := ((2 \[Alpha])/3 + 
   1/3 ((-q[\[Alpha], \[CapitalPhi], \[Kappa]] + Sqrt[
      q[\[Alpha], \[CapitalPhi], \[Kappa]]^2 - 
       4 p[\[Alpha], \[CapitalPhi], \[Kappa]]^3])/2)^(1/3) + 
   p[\[Alpha], \[CapitalPhi], \[Kappa]]/
    3 ((-q[\[Alpha], \[CapitalPhi], \[Kappa]] + Sqrt[
      q[\[Alpha], \[CapitalPhi], \[Kappa]]^2 - 
       4 p[\[Alpha], \[CapitalPhi], \[Kappa]]^3])/2)^(-(1/3)))^(1/2)

This is where I use RegionPlot and ContourPlot commands.

contour = 
  ContourPlot[{A[\[Alpha], \[CapitalPhi], 2]}, {\[CapitalPhi], 0, 
    2 Pi}, {\[Alpha], -10, 10}];

This is where I use RegionPlot and ContourPlot commands.

region = RegionPlot[{q[\[Alpha], \[CapitalPhi], 2]^2 - 
      4 p[\[Alpha], \[CapitalPhi], 2]^3 > 0}, {\[CapitalPhi], 0, 
    2 Pi}, {\[Alpha], -10, 10}, PlotPoints -> 5, 
   BoundaryStyle -> None, 
   PlotStyle -> {{Green, Opacity[0.5]}}];

Finally superimposing the figures.

Show[contour, region]


The linked question There are mesh grids when Export RegionPlot solves my question. However, they plot points are not enough and the rgion is not exactly how I expect it to be.

  • $\begingroup$ Please post your code. $\endgroup$
    – cvgmt
    Jan 31, 2022 at 23:44
  • 1
    $\begingroup$ Does this answer your question? There are mesh grids when Export RegionPlot or Problem with exporting RegionPlot as PDF $\endgroup$
    – Domen
    Feb 1, 2022 at 0:03
  • $\begingroup$ @cvgmt I added my code. I simplified it so that output is not exactly the same as the figure I posted. $\endgroup$ Feb 1, 2022 at 0:04
  • $\begingroup$ @Domen Thank you. That does solves the issue of meshgrid showing up. However, it looks like there are not enough plot points when I plot the figure (shown above) using this method and the figure gets cut out. Is there a way to increase the plot points? It does not let me use PlotPoints -> 50 inside the function Region[] and ImplicitRegion[] $\endgroup$ Feb 1, 2022 at 0:36
  • $\begingroup$ Perhaps you can write a new question to address this emergent problem? $\endgroup$ Feb 1, 2022 at 12:12