Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand 3-D basemap properties with back-walls and gridlines #3993

Merged
merged 32 commits into from
Aug 23, 2020

Conversation

seisman
Copy link
Member

@seisman seisman commented Aug 18, 2020

Until now, the +b did two things: Turned on 3-D back-walls if gridlines were requested and draw the 3-D box, sometimes overprinting the main illustration. This PR adds +B as an alternative. Same as +b but does not draw the 3-D box outline. This addresses one of the many points in #3983.

I left this as WIP because I would have preferred +b to do what +B does now, and let +B be the one that adds the corner lines, but that would break backwards compatibility.
What say you @joa-quim who started this?

let +g set xy plan color, while +x and +y optionally set the other two side.
Until now, the +b did twh things: Turned on 3-D backwalls if gridlines were requested and draw the 3-D box, sometimes overprinting the main illustration.  This PR adds +B as an alternative.  Same as +b but does not draw the 3-D box outline.
@joa-quim
Copy link
Member

I find it a bit awkward to have a -B...+B... syntax. Can't we just make it +w for walls?

@PaulWessel
Copy link
Member

Yes, I guess I did not spend too much time thinking about this. We have +b which does both walls, gridlines (if selected), and the corner box. I am OK with using +w to turn on walls. So then +b is +w plus the corner box.
I'm having a zoom with Remko tonight regarding the plane proejction and drawing on those walls.

@joa-quim
Copy link
Member

joa-quim commented Aug 18, 2020

But +b is required for z grid lines so +w should do that grid lines activation as well.

@PaulWessel
Copy link
Member

Yes, only difference between +b and +w is that +b draws the corner lines you dont like on top of things.

@PaulWessel
Copy link
Member

Hope you like the +w, @joa-quim.

@PaulWessel
Copy link
Member

Update: Given that I will be working on a PR that will allow painting of the backwall, I am not sure +w is needed at all. I think we want this behavior for 3-D plots:

  1. If -B specifies the z-axis then the vertical z-axis is plotted and annotated as requested [current behavior]
  2. If -B specifies gridlines via -Bz then we draw the backwall gridlines, no +b required for this [currently requires +b]
  3. If -B specifies painting of the backwall (via +x[fill} and +y[fill] modifiers) then we do that, no +b required.

This means +b is simply a modifier that adds the 3-D box and nothing more. This means it is not the default behavior and thus should meet with @seisman approval. The rest are improvements, @seisman.

Please give me the go-ahead to finalized these changes via a comment here, and I will finish this PR to just deal with point 2; the coloring will be another PR.

@seisman
Copy link
Member Author

seisman commented Aug 19, 2020

2. If -B specifies gridlines via -Bz then we draw the backwall gridlines, no +b required for this [currently requires +b]

It makes sense to me. One more thing, as @joa-quim mentioned in #3983, should we also draw the X and Y gridlines in the backwalls?

@PaulWessel
Copy link
Member

Yes, I am/will be working on the xy gridlines as well - had a zoom with Remko last night and ready to go. But trying to break this into smaller PRs so it will come as an enhancement to the gridlines. I think we only draw gridlines on the back if -Bz gridlines are set. If you just give -Bafg -Bzaf then you get no gridlines on the backwalls since you did not request z gridlines.

@seisman
Copy link
Member Author

seisman commented Aug 19, 2020

How to plot a figure like this one, but without any gridlines on the backwall?
image

@PaulWessel
Copy link
Member

gmt basemap -JX12c/0 -Bafg -Bzaf -BWSenZ+b+ggray -p210/30 -JZ10 -R-2/2/-1/3/0/4 -png map

Since no -Bz the +b just draws the cube @joa-quim hates. BTW, for modern mode I think -Bz with no arguments, like -B, should imply -Bzaf [currently gives an error].

@seisman
Copy link
Member Author

seisman commented Aug 19, 2020

Your command gives me this figure.
image

But what I'm expecting is:
image

@seisman
Copy link
Member Author

seisman commented Aug 19, 2020

BTW, for modern mode I think -Bz with no arguments, like -B, should imply -Bzaf [currently gives an error].

Yes, I agree.

@PaulWessel
Copy link
Member

I see. Well, we have no scheme for that. Let's see the many ways we want to backwalls to be

  • No back walls, just the cube outlines [my example using +b]
  • Transparent back walls, just the wall outlines [your example - not possible yet]
  • Transparent back walls with gridlines [currently only z-gridlines but xy coming]
  • Opaque back walls, to be implemented with +x +y. If no fill given then same as xy fill (-B+gfill)
  • Opaque back walls, with gridlines (will need +x, +y and -Bz...g)

Possible ways to include your case:

  1. Let that be the default (backwards incompatible but we can always claim it as a bug) so no new modifier needed
  2. Re-introduce a +w for just the back wall outline. I think we want to be able to show or not show the wall, so taht will need a modifier, hence +w. The +w can mean "Draw the back wall outlines". That way, you can separately paint via +x +y without drawing those lines.

Unresolved or hidden issues:

Pen: I think the box pen uses the gridline pen. This seems certainly appropriate for the 3-D box part, but the outlines of the back wall should possibly be using the FRAME_PEN? I am not sure if that will look too bold, but since it is a 3-D plot it would seem reasonable to use that default for this and not have a separate +wpen modifier, no?
Back wall with gridlines: There is no fill of this wall, and I think that is OK unless fill is requested, just as for the xy plane. I.e., there is no default fill, just open.

@PaulWessel
Copy link
Member

BTW, for modern mode I think -Bz with no arguments, like -B, should imply -Bzaf [currently gives an error].

Yes, I agree.

Hm, the code seems to do this already:

	else if (code[0] == 'z' && code[1] == '\0') {	/* If indicating z we do -Bzaf */
		strcpy (args, "zaf");	if (c) strcat (args, c);
	}

but

gmt basemap -JX12c/0 -Bafg -Bz -BWSenZ+b+ggray -p210/30 -JZ10 -R-2/2/-1/3/0/4 -png map
basemap [ERROR]: Option -B parsing failure. Correct syntax:
	-B[p|s][x|y|z]<intervals>[+a<angle>|n|p][+l|L<label>][+p<prefix>][+u<unit>] -B[<axes>][+b][+g<fill>][+o<lon>/<lat>][+t<title>] OR
	-B[p|s][x|y|z][a|f|g]<tick>[m][l|p] -B[p|s][x|y|z][+l<label>][+p<prefix>][+u<unit>] -B[<axes>][+b][+g<fill>][+o<lon>/<lat>][+t<title>]
basemap [ERROR]: Offending option -BWSenZ+b+ggray

So will debug that case.

@PaulWessel
Copy link
Member

But switching the order to -Bz -Bafg works, since the other way sets a bool so that we dont go into this section of code again... So that needs some work.

@joa-quim
Copy link
Member

The PENs. See this. I think it looks better the way they have it. Just grid line pens even at the base of the walls. At least when the walls are painted.

@PaulWessel
Copy link
Member

I disagree that it looks better by not clearly drawing the xy plane bounds as we do. That figure reeks of ugly, especially the crooked flat annotations. Anyway, sounds like this conundrum can only be solved by +w[pen] then since taste cannot be dictated.

github-actions bot pushed a commit that referenced this pull request Aug 21, 2020
@PaulWessel
Copy link
Member

Some good points here and some lack of clarity. I (foolishly) decided that +x will paint the xz plane and y will do yz, so +z would do xy, but of course that seems like bad syntax. Your thinking (x means yx, y means xz, and z means xy) is more consistent. So part of the issue above is taht confusion. I will change that.
As for combinations of +g and the others. I agree that +g should apply first to all three, then any x,y,z will overwrite.
As for the side of the annot on the vertical axis: I agree the other side would be better and will see what control I have.
And your first case specifying the z-axis placement may need to be looked at more - I did not test that.

seisman pushed a commit that referenced this pull request Aug 21, 2020
@PaulWessel
Copy link
Member

Hi @seisman, I have addressed the definition of +x +y, that +g sets all three unless +x|y|z are also given, and I have adjusted if we plot the z-annotations "above" or "below" the axis depending on the axis and the quadrant. See if you agree with all of that - some of the choices are arbitrary but I have tried to ahve the annotation be "outside" the plot. For axis that end up in the back corner there really is no good chice.

@PaulWessel
Copy link
Member

PaulWessel commented Aug 23, 2020

These combinations of axis (1-4) and quadrant (1-4) gives annotation that likely will overprint things that are plotted or will be hidden behind an opaque wall:

    Z1  Z2  Z3  Z4
q1  x       x
q2      x        x
q3  x       x
q4      x        x

@seisman
Copy link
Member Author

seisman commented Aug 23, 2020

These changes look good to me.

The +b issue isn't fixed yet:

gmt basemap -JX12c/0 -p250/30 -JZ10 -R-12/2/-51/-37/0/4 -pdf map -Bafg -BWSenZ3+b+glightblue -Bzafg

@PaulWessel
Copy link
Member

Now the +b should work better since I now wait until the end to draw the lines. As you can see, the annotations for the axis when placed on the back point are printed on top of the inner wall, so they are not blocked by that opaque wall. I think I could possibly switch that around so you would only see the last tick and "4", but not sure if that is useful at all. If the user care to see those values they should go with axis 2 or 4 [default].

@seisman
Copy link
Member Author

seisman commented Aug 23, 2020

Looks good to me. One more error:

gmt basemap -JX12c/0 -p250/30 -JZ10 -R-12/2/-51/-37/0/4 -png map -Bafg -BWSenZ+w1p,red -Bzafg

Copy link
Member Author

@seisman seisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I can't approve this PR, since I opened it.

@seisman
Copy link
Member Author

seisman commented Aug 23, 2020

@PaulWessel you pushed the commit 8246898 to the wrong branch.

@PaulWessel
Copy link
Member

Ouch, how to undo? Can you do it?

@seisman
Copy link
Member Author

seisman commented Aug 23, 2020

Ouch, how to undo? Can you do it?

Done.

@PaulWessel
Copy link
Member

Thanks, so I may approve this one now?

@seisman
Copy link
Member Author

seisman commented Aug 23, 2020

OK to me.

@PaulWessel PaulWessel merged commit 50464ca into master Aug 23, 2020
@PaulWessel PaulWessel deleted the 3d-box-on-top branch August 23, 2020 17:53
@seisman
Copy link
Member Author

seisman commented Aug 24, 2020

Master branch CI jobs fail with following errors:

	176 - ex08/ex08.sh (Failed)
	178 - ex10/ex10.sh (Failed)
	487 - grdview/cuerpo.sh (Failed)
	488 - grdview/denver.sh (Failed)
	499 - greenspline/gspline_4.sh (Failed)
	843 - psxyz/3dbars.sh (Failed)
	848 - psxyz/geovector.sh (Failed)
	849 - psxyz/geovector2.sh (Failed)
	859 - psxyz/wedges.sh (Failed)

Did you forget to update the original PS files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants