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

Rotating the symbols of a decorated line does not work ("+aangle") #7591

Closed
yvonnefroehlich opened this issue Jul 2, 2023 · 1 comment · Fixed by #8182
Closed

Rotating the symbols of a decorated line does not work ("+aangle") #7591

yvonnefroehlich opened this issue Jul 2, 2023 · 1 comment · Fixed by #8182
Labels
bug Something isn't working

Comments

@yvonnefroehlich
Copy link
Member

Description of the problem

Based on the documentation at https://docs.generic-mapping-tools.org/dev/plot.html#s it should be possible to rotate the symbols of a decorated line by appending +aangle:

+aangle
Force symbols at a fixed angle, +an for line-normal, or +ap for line-parallel [Default].

However, so far this does not work for me. For quoted lines, it works to rotate the label by appending +aangle.
Related PyGMT comment GenericMappingTools/pygmt#2564 (comment).

Full script that generated the error

Input data: test_data_deco_line.txt

gmt plot test_data_deco_line.txt -R0/10/-1/1 -JX10c/3c -B -S~d2c:+ss1c+a20 -W1p,black -png deco_lines_rot_gmt

Full error message

No error message occurs.

Actual outcome

deco_lines_rot_gmt

Expected outcome

The squares along the line should be rotated by 20 degrees (counter-clockwise from the horizontal); similar to quoted lines:

gmt plot  test_data_deco_line.txt  -R0/10/-1/1 -JX10c/3c -B -Sqd1c:+ltext+a20 -W1p,black -png quot_lines_rot_gmt

quot_lines_rot_gmt

System information

  • Operating system: Windows-10-10.0.19045-SP0
  • GMT version (gmt --version): 6.4.0 as well as 6.5.0_95c3431_2023.06.26
@PaulWessel
Copy link
Member

Mystery so far. At the end of gmtsupport_add_decoration we have

	/* Build record with Cartesian (hence col = GMT_Z) "x y angle symbol" since we are using -Jx1i */
	S->data[GMT_X][S->n_rows] = L->x;
	S->data[GMT_Y][S->n_rows] = L->y;
	S->data[GMT_Z][S->n_rows] = gmt_M_to_inch (GMT, G->size);
	S->data[3][S->n_rows] = L->line_angle;	/* Change this in inches internally instead of string */
	S->text[S->n_rows++] = strdup (G->symbol_code);

G->line_angle is 20 as given, but S->data[3][S->n_rows] which is S->data[3][0] for the first point remains 0 after the assignment. How is that possible? When the temp file is built and passed to plot again it has x, y ,size, angle, but angle is zero for all record. Hence the result above.

PaulWessel added a commit that referenced this issue Dec 11, 2023
This fixes the bug in #7591. While at it, we allow +apangle to let the symbol angle deviate by angle from the line's angle.+aangle still sets a fixed angle regardless of angle contortions.
PaulWessel added a commit that referenced this issue Dec 11, 2023
* Fix failure to honor +a angle in decorated lines

Simply did not pass the fixed angle when it was set and ended up passing the line angle which was zero.

* Fix bug and allow +apangle for decorated lines

This fixes the bug in #7591. While at it, we allow +apangle to let the symbol angle deviate by angle from the line's angle.+aangle still sets a fixed angle regardless of angle contortions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants