Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have

h[phi_, delta_] := ArcCos[-Tan[phi Degree] Tan[delta Degree]]
insolation[phi_, delta_, S_: 1368] := (S/Pi) (Cos[delta Degree] Cos[phi Degree] Sin[h] + h Sin[delta Degree] Sin[phi Degree]) /. h -> h[phi, delta]
ContourPlot[insolation[phi, 23.5 Cos[t]], {t, -Pi, Pi}, {phi, -90, 90},
    PlotLegends -> Automatic, ContourLabels -> False, Contours -> 20, 
    ColorFunction -> "TemperatureMap"]

But the resulting figure has areas that are "missing":

What am I doing wrong? How do I get the expected vertical contours extending from the truncated edges to the near horizontal axis in the upper center and bottom right and left corners? How to I "fill in" the regions in the upper right and left corners that are 0?


A similar figure for comparison:

share|improve this question
    
@Kuba: How do I prevent my uploaded images from being HUGE when I upload Retina screenshots (maybe a meta question; this issue must have come up before)? –  raxacoricofallapatorius Mar 12 at 19:19
    
Make it a meta question and I'll reply. –  Szabolcs Mar 12 at 19:19
1  
That region of the contour plot is white because the expression insolation[phi, 23.5 Cos[t]] evaluates to non-real complex numbers at those t,phi points. I tried this by right-clicking the plot, and using Get Coordinates to sample coordinates from that region, then putting them into the expression. –  Szabolcs Mar 12 at 19:20
    
@Szabolcs: Asked. –  raxacoricofallapatorius Mar 12 at 19:23
1  
@Kuba I must leave now and I might forget when I come back ... feel free to post it yourself and include the PlotRange->All comment .. –  Szabolcs Mar 12 at 20:22

1 Answer 1

up vote 2 down vote accepted

Usually such issue is caused by Automatic Range and PlotRange->All would be a fix. It's not the case though.

Szabolcs has noticed:

That region of the contour plot is white because the expression insolation[phi, 23.5 Cos[t]] evaluates to non-real complex numbers at those t, phi points. I tried this by right-clicking the plot, and using GetCoordinates to sample coordinates from that region, then putting them into the expression.

So the quick fix is to take only a real part:

ContourPlot[
 Re@insolation[phi, 23.5 Cos[t]], {t, -Pi, Pi}, {phi, -90, 90}, 
 PlotLegends -> Automatic, ContourLabels -> False, Contours -> 20, 
 ColorFunction -> "TemperatureMap"]

enter image description here

Keep in mind that PlotRange issue could be still a case here, but it isn't :).

Also, this is quick fix, but at the end one should think what taking a real part means for us here or what does it mean our function produced complex values.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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