Skip to content

Commit

Permalink
add tick examples with ranges, closes #905
Browse files Browse the repository at this point in the history
  • Loading branch information
tlnagy committed Oct 3, 2016
1 parent 7cba275 commit 22d4659
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/src/lib/guides/guide_xticks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ plot(x=rand(10), y=rand(10), Geom.line, Guide.xticks(ticks=ticks, label=false))
```@example 1
plot(x=rand(10), y=rand(10), Geom.line, Guide.xticks(ticks=ticks, orientation=:vertical))
```

Range types can also be used

```@example 1
plot(x=rand(1:10, 10), y=rand(1:10, 10), Geom.line, Guide.xticks(ticks=[1:9;]))
```

!!! note

The `;` in `ticks=[1:9;]` is required to flatten the `1:9` range type into
`[1, 2, 3, ...]`. Alternatively, `collect` can be used in the following
manner `ticks=collect(1:9)`.
12 changes: 12 additions & 0 deletions docs/src/lib/guides/guide_yticks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ plot(x=rand(10), y=rand(10), Geom.line, Guide.yticks(ticks=ticks, label=false))
```@example 1
plot(x=rand(10), y=rand(10), Geom.line, Guide.yticks(ticks=ticks, orientation=:vertical))
```

Range types can also be used

```@example 1
plot(x=rand(1:10, 10), y=rand(1:10, 10), Geom.line, Guide.yticks(ticks=[1:9;]))
```

!!! note

The `;` in `ticks=[1:9;]` is required to flatten the `1:9` range type into
`[1, 2, 3, ...]`. Alternatively, `collect` can be used in the following
manner `ticks=collect(1:9)`.

1 comment on commit 22d4659

@shashi
Copy link
Collaborator

@shashi shashi commented on 22d4659 Oct 4, 2016

Choose a reason for hiding this comment

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

I don't see why ticks=1:9 (or even x=1:9) should not work...

Please sign in to comment.