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[\
\[CapitalPhi]]
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]
Update:
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.
PlotPoints -> 50inside the functionRegion[]andImplicitRegion[]– diffusiondiver11 Feb 01 '22 at 00:36