1
$\begingroup$

I drew a contour plot using the option RegionFunction. but it gave me lots of unwanted contour lines inside the plot. I want to remove all of them just remaining the colored part.

enter image description here

The code for this plot is below.

NeutrinoTrident[MZprime_, s24squad_] := (s24squad/MZprime)^2
UpperBound = (1/370)^2
ContourPlot[
NeutrinoTrident[MZprime, s24squad], {MZprime, 100, 1000}, {s24squad, 
0, 1}, ScalingFunctions -> {"Log", "Log"}, 
FrameLabel -> {Style["\!\(\*SubscriptBox[\(M\), \(Z'\)]\)[GeV]", 
FontSize -> 16], 
Style["\!\(\*SuperscriptBox[\(sin\), \(2\)]\)\!\(\*SubscriptBox[\(\
\[Theta]\), \(24\)]\)", FontSize -> 16]}, 
BaseStyle -> {FontFamily -> "Times", FontSize -> 14}, 
RegionFunction -> 
Function[{MZprime, s24squad} , NeutrinoTrident <= UpperBound], 
PlotRange -> {{100 - 10^-10, 1000}, {10^-3, 1}}, 
ContourShading -> {LightBlue}]

Could anyone help me to remove unwanted lines inside the plot?

$\endgroup$
  • $\begingroup$ Try RegionPlot instead of ContourPlot or use the option Contours->{} inside ContourPlot $\endgroup$ – Ulrich Neumann Mar 5 at 16:00
  • $\begingroup$ @UlrichNeumann I already considered RegionPlot but there were lots of difficulties when I turned it into LogLog scale. So I thought drawing the plot in the ContourPlot is easier than turning the plot into LogLog scale in RegionPlot. $\endgroup$ – lhcQFT Mar 5 at 16:05
  • $\begingroup$ The question is closely related to this question $\endgroup$ – m_goldberg Mar 6 at 22:27
3
$\begingroup$

I think this is what you are looking for.

NeutrinoTrident[MZprime_, s24squad_] := (s24squad/MZprime)^2
UpperBound = (1/370)^2;

ContourPlot[
  NeutrinoTrident[MZprime, s24squad], {MZprime, 100, 1000}, {s24squad, 0, 1},
  ScalingFunctions -> {"Log", "Log"},
  FrameLabel ->
    {Style[Subscript[M, Derivative[1][Z]][GeV], FontSize -> 16], 
     Style[Row @ {sin^2, Subscript[θ, 24]}, FontSize -> 16]}, 
  BaseStyle -> {FontFamily -> "Times", FontSize -> 14},
  RegionFunction -> (NeutrinoTrident[#1, #2] <= UpperBound &), 
  PlotRange -> {{100 - 10^-10, 1000}, {10^-3, 1}},
  Contours -> {UpperBound},
  ContourShading -> {LightBlue}]

plot

Update

After reading @kglr's answer here, I realized that this answer also needed to give PlotRange the 3rd element All. If I had done that, you probably wouldn't have needed to ask your follow-up question.

Here is the corrected version of my the above plot:

ContourPlot[
  NeutrinoTrident[MZprime, s24squad], {MZprime, 100, 1000}, {s24squad, 0, 1}, 
  ScalingFunctions -> {"Log", "Log"},
  FrameLabel ->
   {Style[Subscript[M, Derivative[1][Z]][GeV], FontSize -> 16], 
    Style[Row@{sin^2, Subscript[\[Theta], 24]}, FontSize -> 16]}, 
  BaseStyle -> {FontFamily -> "Times", FontSize -> 14}, 
  RegionFunction -> (NeutrinoTrident[#1, #2] <= UpperBound &), 
  PlotRange -> {{100 - 10^-10, 1000}, {10^-3, 1}, All},
  ContourShading -> {LightBlue}]

plot_corrected

In the case where you want have the contour at UpperBound to be visible, then the corrected plot would be:

ContourPlot[
  NeutrinoTrident[MZprime, s24squad], {MZprime, 100, 1000}, {s24squad, 0, 1},
  ScalingFunctions -> {"Log", "Log"},
  FrameLabel ->
   {Style[Subscript[M, Derivative[1][Z]][GeV], FontSize -> 16], 
    Style[Row@{sin^2, Subscript[\[Theta], 24]}, FontSize -> 16]}, 
  BaseStyle -> {FontFamily -> "Times", FontSize -> 14}, 
  RegionFunction -> (NeutrinoTrident[#1, #2] <= UpperBound &), 
  PlotRange -> {{100 - 10^-10, 1000}, {10^-3, 1}, All},
  Contours -> {.995 UpperBound},
  ContourStyle -> {Thick},
  ContourShading -> {LightBlue}]

plot_with_contour

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.