You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plot and plot3d: Allow passing an array as symbol #1076
We can now use a 1d array for sizes and color parameters, and intensity can also accept a 1d array after #1065. Therefore, we may also support a 1d array as symbol or symbols (originally posted in #1065 (comment)).
The format of the input file of GMT plot (including both -S and -I):
x y [ z ] [ size ] [ symbol-parameters ] [ intensity ] [ symbol ]
z corresponds to the color parameter in PyGMT
size corresponds to the sizes parameter in PyGMT (I don't know why we add a "s")
A bit of a side issue, but do you think we can make a generic _plot function that shares some common code between plot and plot3d, as is being done with blockmean and blockmode at #1091?
A bit of a side issue, but do you think we can make a generic _plot function that shares some common code between plot and plot3d, as is being done with blockmean and blockmode at #1091?
I quickly checked the current source codes of those two methods in PyGMT, which are the same except that plot3d has an additional z parameter. So I think it's a good suggestion to make a generic _plot function.
There are still many unimplemented and complicated features/options in plot and plot3d. I would prefer NOT to make the generic _plot function until we have more thoughts on the possible features and changes.
There are still many unimplemented and complicated features/options in plot and plot3d. I would prefer NOT to make the generic _plot function until we have more thoughts on the possible features and changes.
That's true. Actually, I think I found two bugs when I try to work on this issue for the plot method. Will double-check before submitting them.
For this issue, shall we create a new parameter called symbol or symbols (which one is better?) to accept 1d-array symbols or just use the style parameter instead? I prefer to have a new parameter, just like the sizes parameter (I dont' understand why we add a s at the end) of the plot/plot3d method. How do you think?
like the sizes parameter (I dont' understand why we add a s at the end) of the plot/plot3d method
plot is one of the oldest wrappers in PyGMT, and the parameters are not carefully chosen. We had some discussions in the GMT Community meeting, and I think we agree that we will change sizes to size.
shall we create a new parameter called symbol or symbols (which one is better?) to accept 1d-array symbols or just use the style parameter instead?
I'm not sure if we should reuse style or not. If you'd like to work on this feature, I think you can use symbol first, then we can decide which one is better based on your changes.
plot is one of the oldest wrappers in PyGMT, and the parameters are not carefully chosen. We had some discussions in the GMT Community meeting, and I think we agree that we will change sizes to size.
Sound great.
shall we create a new parameter called symbol or symbols (which one is better?) to accept 1d-array symbols or just use the style parameter instead?
I'm not sure if we should reuse style or not. If you'd like to work on this feature, I think you can use symbol first, then we can decide which one is better based on your changes.
@core-man Thanks for your quick PR in #1117. Here are the possible ways to set symbols and sizes after your PR. I feel some of them are not intuitive to me.
constant symbol and size: style="c0.5c"
constant symbol and different sizes: style="cc" + sizes=sizes
Although we use style="cc" in our documentation, I still don't think it's not easy to understand.
different symbols and constant size: style="0.5c" + symbol=symbol
I believe most users would use symbol=symbol + sizes="0.5c".
different symbols and sizes: style=True + sizes=sizes + symbol=symbol
@seisman based on your comments, I think you are requesting that we should use symbol and sizes instead of style, which I also prefer because it is more intuitive. I will try to work on it.
different symbols and constant size: style="0.5c" + symbol=symbol
I believe most users would use symbol=symbol + sizes="0.5c".
Shall we support a string 1d-array for the sizes parameter? Now it only accepts int and float (e.g., 1, 0.5) and does not accept string (e.g., 0.5c), although we can set the unit using the config method.
different symbols and sizes: style=True + sizes=sizes + symbol=symbol
Just following up on this. I think having 3 parameters (style/symbol/size) will get too confusing. If 'style' is not a good alias name for -S, perhaps we should deprecate it using @deprecate_parameter and rename 'style' to 'symbol' as hinted by @core-man at #1117 (comment)? I.e. keep only 2 parameters (symbol and size).
Just following up on this. I think having 3 parameters (style/symbol/size) will get too confusing. If 'style' is not a good alias name for -S, perhaps we should deprecate it using @deprecate_parameter and rename 'style' to 'symbol' as hinted by @core-man at #1117 (comment)? I.e. keep only 2 parameters (symbol and size).
Good idea: First, deprecate style to symbol first, and then we could work on the remaining two parameters, i.e., symbol and size. Any comment @seisman?
@seisman, considering that meca supports longitude, latitude, depth, plot_longitude, plot_latitude, event_name as lists/arrays since the refactor in #1784 by putting everything into a spec dict and turning it into a pandas.DataFrame, could we do something similar here for plot/plot3d to handle symbols? This chunk of code in particular:
Activity
weiji14 commentedon Mar 23, 2021
A bit of a side issue, but do you think we can make a generic
_plotfunction that shares some common code betweenplotandplot3d, as is being done withblockmeanandblockmodeat #1091?core-man commentedon Mar 23, 2021
I quickly checked the current source codes of those two methods in PyGMT, which are the same except that
plot3dhas an additionalzparameter. So I think it's a good suggestion to make a generic_plot function.seisman commentedon Mar 23, 2021
There are still many unimplemented and complicated features/options in plot and plot3d. I would prefer NOT to make the generic
_plotfunction until we have more thoughts on the possible features and changes.core-man commentedon Mar 23, 2021
That's true. Actually, I think I found two bugs when I try to work on this issue for the
plotmethod. Will double-check before submitting them.core-man commentedon Mar 23, 2021
For this issue, shall we create a new parameter called
symbolorsymbols(which one is better?) to accept 1d-array symbols or just use thestyleparameter instead? I prefer to have a new parameter, just like thesizesparameter (I dont' understand why we add a s at the end) of theplot/plot3dmethod. How do you think?seisman commentedon Mar 23, 2021
plotis one of the oldest wrappers in PyGMT, and the parameters are not carefully chosen. We had some discussions in the GMT Community meeting, and I think we agree that we will changesizestosize.I'm not sure if we should reuse
styleor not. If you'd like to work on this feature, I think you can usesymbolfirst, then we can decide which one is better based on your changes.core-man commentedon Mar 23, 2021
Sound great.
Great. I will try~
seisman commentedon Mar 25, 2021
@core-man Thanks for your quick PR in #1117. Here are the possible ways to set symbols and sizes after your PR. I feel some of them are not intuitive to me.
Although we use
style="cc"in our documentation, I still don't think it's not easy to understand.I believe most users would use
symbol=symbol+sizes="0.5c".The
style=Trueshould NOT be required.core-man commentedon Mar 25, 2021
We can use
style="c"for this case because the default unit is cetimeter. The unit can also be set by the PROJ_LENGTH_UNIT using theconfigmethod.That's true, but it seems that
sizescannot work for a single string or a 1d-array string now. We may refractor it. See the last comment below.Good suggestion. Will include in #1117.
@seisman based on your comments, I think you are requesting that we should use
symbolandsizesinstead ofstyle, which I also prefer because it is more intuitive. I will try to work on it.core-man commentedon Apr 13, 2021
Shall we support a string 1d-array for the
sizesparameter? Now it only accepts int and float (e.g., 1, 0.5) and does not accept string (e.g., 0.5c), although we can set the unit using theconfigmethod.Fixed in
1c48b39. See #1117 (comment). We only need to usesymbol=symbol, sizes=sizes.weiji14 commentedon May 18, 2021
Just following up on this. I think having 3 parameters (style/symbol/size) will get too confusing. If 'style' is not a good alias name for -S, perhaps we should deprecate it using
@deprecate_parameterand rename 'style' to 'symbol' as hinted by @core-man at #1117 (comment)? I.e. keep only 2 parameters (symbol and size).core-man commentedon May 20, 2021
Good idea: First, deprecate
styletosymbolfirst, and then we could work on the remaining two parameters, i.e.,symbolandsize. Any comment @seisman?weiji14 commentedon Jun 8, 2023
@seisman, considering that
mecasupportslongitude,latitude,depth,plot_longitude,plot_latitude,event_nameas lists/arrays since the refactor in #1784 by putting everything into aspecdict and turning it into apandas.DataFrame, could we do something similar here forplot/plot3dto handle symbols? This chunk of code in particular:pygmt/pygmt/src/meca.py
Lines 319 to 332 in 6c69fb6
The
specdict is then converted to apandas.DataFrame, and passed in tolib.virtualfile_from_datavia thedataparameter here:pygmt/pygmt/src/meca.py
Line 369 in 6c69fb6
Maybe we could create a reusable function out of this somehow?
seisman commentedon Jun 8, 2023
Sounds a promising idea.
seisman commentedon Oct 29, 2024
Implemented in PR #1117 and #3559.