Skip to content

Commit 2fbcf1d

Browse files
committed
Release 0.3.0
1 parent bbef726 commit 2fbcf1d

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

README.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ A simplest interface library to enable your java project to use matplotlib.
77

88
Of course it is able to be imported to scala project as below. The API is designed as similar to the original matplotlib's.
99

10-
![Screenshot](https://user-images.githubusercontent.com/6478810/31043250-bdacdd12-a5f3-11e7-88ee-0e91c851c6f7.png)
10+
<img src="https://user-images.githubusercontent.com/6478810/31043250-bdacdd12-a5f3-11e7-88ee-0e91c851c6f7.png" width="520px">
11+
1112

1213
## How to use
1314

@@ -29,7 +30,7 @@ plt.show();
2930

3031
Another example to draw **Contour**
3132

32-
![Screenshot](https://user-images.githubusercontent.com/6478810/31847390-d2422f2a-b656-11e7-9fca-d503cd70a253.png)
33+
<img src="https://user-images.githubusercontent.com/6478810/31847390-d2422f2a-b656-11e7-9fca-d503cd70a253.png" width="520px">
3334

3435
```java
3536
// Data generation
@@ -50,6 +51,29 @@ plt.legend().loc("upper right");
5051
plt.show();
5152
```
5253

54+
In addition to the interactive window opened by `.show()`, `.savefig()` is also supported.
55+
Only one thing to note is that `plt.executeSilently()` triggers to output figure files after calling `.savefig()`,
56+
this is by design as method chain coding style.
57+
58+
```java
59+
Random rand = new Random();
60+
List<Double> x = IntStream.range(0, 1000).mapToObj(i -> rand.nextGaussian())
61+
.collect(Collectors.toList());
62+
63+
Plot plt = Plot.create();
64+
plt.hist().add(x).orientation(HistBuilder.Orientation.horizontal);
65+
plt.ylim(-5, 5);
66+
plt.title("histogram");
67+
plt.savefig("/tmp/histogram.png").dpi(200);
68+
69+
plt.executeSilently();
70+
```
71+
72+
This code generates the following picture.
73+
74+
<img src="https://user-images.githubusercontent.com/6478810/32616055-c0ec5652-c5b4-11e7-9824-a1628b3b5141.png" width="520px">
75+
76+
5377
### Pyenv support
5478

5579
It is possible to choose a python environment to run matplotlib with `pyenv` and `pyenv-virtualenv` support. Create `Plot` object by specifying existing names as follows.
@@ -73,7 +97,7 @@ It may work with almost all not too old `Python` and `Matplotlib` versions, but
7397

7498
## Configure on your project
7599

76-
This library is now found on [maven central repository](http://search.maven.org/#artifactdetails%7Ccom.github.sh0nk%7Cmatplotlib4j%7C0.2.0%7Cjar).
100+
This library is now found on [maven central repository](http://search.maven.org/#artifactdetails%7Ccom.github.sh0nk%7Cmatplotlib4j%7C0.3.0%7Cjar).
77101

78102
Import to your projects as follows.
79103

@@ -83,16 +107,14 @@ Import to your projects as follows.
83107
<dependency>
84108
<groupId>com.github.sh0nk</groupId>
85109
<artifactId>matplotlib4j</artifactId>
86-
<version>0.2.0</version>
110+
<version>0.3.0</version>
87111
</dependency>
88112
```
89113

90114
**Gradle**
91115

92-
Make sure that `mavenLocal()` is defined in repositories on your `build.gradle`.
93-
94116
```groovy
95-
compile 'com.github.sh0nk:matplotlib4j:0.2.0'
117+
compile 'com.github.sh0nk:matplotlib4j:0.3.0'
96118
```
97119

98120
# License

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: "maven"
44
apply plugin: "signing"
55

66
group 'com.github.sh0nk'
7-
version '0.2.1-SNAPSHOT'
7+
version '0.3.0'
88
archivesBaseName = "matplotlib4j"
99
description = "Matplotlib for java: A simple graph plot library for java with powerful python matplotlib"
1010

0 commit comments

Comments
 (0)