Skip to content

Commit

Permalink
Add gallery files
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim committed Mar 17, 2019
1 parent 339b4b6 commit da859ce
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/src/gallery/scripts_agu/bars3_peaks.md
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"/>
```
29 changes: 29 additions & 0 deletions docs/src/gallery/scripts_agu/bars_3D.md
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"/>
```
20 changes: 20 additions & 0 deletions docs/src/gallery/scripts_agu/colored_bars.md
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.
Binary file added docs/src/gallery/scripts_agu/figs/bars_3D.png
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.
4 changes: 4 additions & 0 deletions docs/src/gallery/tables.md
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) |
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ if (got_it) # Otherwise go straight to end
gmtwrite("lixo.grd", rand(5,5), id=:cf)
gmtwrite("lixo.tif", rand(UInt8,32,32,3), driver=:GTiff)
I = gmtread("lixo.tif", img=true, layout="TCP");
I = gmtread("lixo.tif", img=true, band=0);
I = gmtread("lixo.tif", img=true, band=[0 1 2]);
imshow(I, show=false) # Test this one here because we have a GMTimage at hand
gmtwrite("lixo.tif", mat2img(rand(UInt8,32,32,3)), driver=:GTiff)
Expand Down

0 comments on commit da859ce

Please sign in to comment.