-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Make a 3D bar plot with colors in function of bar's height | ||
|
||
Create a 'peaks' grid | ||
|
||
```julia | ||
G = GMT.peaks(); # The grid | ||
cmap = grd2cpt(G); # Colormap with the grid's data range | ||
``` | ||
|
||
Plot that grid as 3D prisms. Here we use the default fig width of 12 cm | ||
|
||
```julia | ||
bar3(G, # 'G' is the grid created above | ||
lw=:thinnest, # Line thickness (0.25 pt) | ||
color=cmap, # Paint the prisms with colormap computed from grid | ||
fmt=:png, # The image format | ||
show=true) # Show the result | ||
``` | ||
|
||
As one-liners (to facilitate copy-paste): | ||
|
||
```julia | ||
G = GMT.peaks(); cmap = grd2cpt(G); | ||
bar3(G, lw=:thinnest, color=cmap, fmt=:png, show=true) | ||
``` | ||
|
||
```@raw html | ||
<img src="../figs/bars3_peaks.png" width="500" class="center"/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Make a 3D bar plot with constant color | ||
|
||
Create a 3x3 grid | ||
|
||
```julia | ||
G = gmt("grdmath -R0/2/0/2 -I1 X Y R2 NEG EXP X MUL ="); | ||
``` | ||
|
||
Plot that grid as 3D prisms | ||
|
||
```julia | ||
bar3(G, # 'G' is the grid created above | ||
fill=(0,115,190), # Fill prisms with this RGB color | ||
lw=:thinnest, # Line thickness (0.25 pt) | ||
figsize=14, # Set fig width of 14 cm | ||
fmt=:png, # The image format | ||
show=true) # Show the result | ||
``` | ||
|
||
As one-liners (to facilitate copy-paste): | ||
|
||
```julia | ||
G = gmt("grdmath -R0/2/0/2 -I1 X Y R2 NEG EXP X MUL ="); | ||
bar3(G, fill=(0,115,190), lw=:thinnest, figsize=14, fmt=:png, show=true) | ||
``` | ||
|
||
```@raw html | ||
<img src="../figs/bars_3D.png" width="600" class="center"/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Make a bar plot where colors are proportional to bar height | ||
|
||
```julia | ||
bar(rand(15), # Generate the dataset | ||
color=:rainbow, # The color scale | ||
figsize=(14,8), # The fig size (14 x 8 cm) | ||
title="Colored bars", # The fig title | ||
fmt=:png, # The image format | ||
show=true) # Show the result | ||
``` | ||
|
||
As a one-liner (to facilitate copy-paste): | ||
|
||
```julia | ||
bar(rand(15), color=:rainbow, figsize=(14,8), title="Colored bars", fmt=:png, show=true) | ||
``` | ||
|
||
```@raw html | ||
<img src="../figs/colored_bars.png" width="500" class="center"/> | ||
``` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
| Colored bars | Bars 3D | Bars 3D peaks | | ||
|:-------------:|:---------:|:-------------:| | ||
|[![](scripts_agu/figs/colored_bars.png)](scripts_agu/colored_bars.md) | [![](scripts_agu/figs/bars_3D.png)](scripts_agu/bars_3D.md) | [![](scripts_agu/figs/bars3_peaks.png)](scripts_agu/bars3_peaks.md) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters