Skip to content

Commit 096b509

Browse files
authored
Merge pull request #1 from ManishDait/beta-1.1
Merge beta to master (Release 1.1.0)
2 parents eb60703 + bd5936e commit 096b509

File tree

132 files changed

+3943
-3410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3943
-3410
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ public class App {
3636
jplotlib.title("Line Plot");
3737
jplotlib.xLabel("xLabel");
3838
jplotlib.yLabel("yLabel");
39-
jplotlib.plot(y).build();
39+
jplotlib.plot(y);
4040
jplotlib.show();
41-
4241
}
4342
}
4443
```
45-
<img src="docs/assets/base_eg1.png" alt="base_eg1.png" width="620px">
44+
<img src="docs/assets/readme_EG1.png" alt="readme_eg1.png" width="620px">
4645

4746
Another Example to draw **MultiLine Plot**
4847

@@ -59,14 +58,14 @@ public class App {
5958
jplotlib.title("Line Plot");
6059
jplotlib.xLabel("xLabel");
6160
jplotlib.yLabel("yLabel");
62-
jplotlib.plot(y1).build();
61+
jplotlib.plot(y1);
62+
jplotlib.plot(y2);
6363
jplotlib.show();
64-
6564
}
6665
}
6766
```
6867

69-
<img src="docs/assets/base_eg2.png" alt="base_eg2.png" width="620px">
68+
<img src="docs/assets/readme_EG2.png" alt="readme_eg2.png" width="620px">
7069

7170
Learn More about Jplotlib in [GETTING_STARTED.md](docs/GETTING_STARTED.md)
7271

docs/BAR.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ public class App {
1919
Jplotlib jplotlib = new Jplotlib();
2020
String[] x = {"A", "B", "C", "D"};
2121
double[] y = {3, 8, 1, 10};
22-
jplotlib.bar(x, y)
23-
.build();
22+
jplotlib.bar(x, y);
2423
jplotlib.show();
2524
}
2625
}
2726
```
2827
In this example, we use the `bar()` method to create a bar graph using `x` as the labels for the x-coordinates and `y` as the y-coordinates. Each bar in the graph represents a category defined by the labels, and its height corresponds to the respective value from `y`.
2928

30-
<img src="assets/bar/bar_eg1.png" alt="bar_eg1.png" width="620px">
29+
<img src="assets/bar/bar_EG1.png" alt="bar_eg1.png" width="620px">
3130

3231
Bar graphs are particularly useful for comparing the values of different categories and displaying discrete data. They are commonly used to visualize categorical data and show how different groups or items compare with each other.
3332

@@ -40,24 +39,53 @@ In Jplotlib, similar to `.plot()`[.color()](PLOT.md) you can customize the color
4039

4140
```java
4241
import io.github.manishdait.jplotlib.Jplotlib;
43-
import io.github.manishdait.jplotlib.style.color.BaseColor;
42+
import io.github.manishdait.jplotlib.defaults.color.LibColor;
4443

4544
public class App {
4645
public static void main(String[] args) {
4746
Jplotlib jplotlib = new Jplotlib();
4847
String[] x = {"A", "B", "C", "D"};
4948
double[] y = {3, 8, 1, 10};
5049
jplotlib.bar(x, y)
51-
.color(BaseColor.PINK.getColor())
52-
.build();
50+
.color(LibColor.PINK.getColor());
5351
jplotlib.show();
5452
}
5553
}
5654
```
5755

58-
In this example, we use the `.color(BaseColor.PINK.getColor())` method with the `bar()` method to set the color of the bars in the bar graph to pink. You can use the `BaseColor` enum to choose from a variety of predefined colors like `BaseColor.RED`, `BaseColor.GREEN`, `BaseColor`.ORANGE, and more.
56+
In this example, we use the `.color(LibColor.PINK.getColor())` method with the `bar()` method to set the color of the bars in the bar graph to pink. You can use the `LibColor` enum to choose from a variety of predefined colors like `LibColor.RED`, `LibColor.GREEN`, `LibColorColor.ORANGE`, and more.
5957

60-
<img src="assets/bar/bar_eg2.png" alt="bar_eg2.png" width="620px">
58+
<img src="assets/bar/bar_EG2.png" alt="bar_eg2.png" width="620px">
6159

6260
You can also use the java.awt.Color class to specify custom colors using RGB values, like `.color(new Color(255, 0, 0))` for red.
6361

62+
# Jplotlib.barh()
63+
64+
The `barh()` method in `Jplotlib` allows you to create Horizonta; 2D bar graphs. It has all similar features like above `bar()` method.
65+
66+
### Method Signature:
67+
68+
```java
69+
barh(String[] xLabels, double[] yPoints)
70+
```
71+
The `barh()` method requires two arrays: `xLabels` containing labels for the x-coordinates (in String format) and `yPoints` containing the corresponding y-coordinates.
72+
73+
### Example Usage:
74+
75+
```java
76+
import io.github.manishdait.jplotlib.Jplotlib;
77+
78+
public class App {
79+
public static void main(String[] args) {
80+
Jplotlib jplotlib = new Jplotlib();
81+
String[] x = {"A", "B", "C", "D"};
82+
double[] y = {3, 8, 1, 10};
83+
jplotlib.barh(x, y);
84+
jplotlib.show();
85+
}
86+
}
87+
```
88+
89+
In this example, we use the `barh()` method to create a bar graph using `x` as the labels for the x-coordinates and `y` as the y-coordinates. Each bar in the graph represents a category defined by the labels, and its width corresponds to the respective value from `x`.
90+
91+
<img src="assets/bar/bar_EG3.png" alt="bar_eg3.png" width="620px">

docs/BASE_COLOR.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/BASE_STROKE.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

docs/GETTING_STARTED.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ double[] y = {2.5, 5.1, 3.9, 6.2};
3333
```
3434
4. Plot the data using the plot() method:
3535
```java
36-
jplotlib.plot(x, y).build();
36+
jplotlib.plot(x, y);
3737
```
3838
5. Add optional elements like grid, labels, and title:
3939
```java
@@ -56,7 +56,7 @@ For more details and additional customization options, you can refer to the [PLO
5656
To create a 2D scatter plot using Jplotlib, follow the same steps as above, but instead of using the `plot()` method, use the `scatter()` method:
5757

5858
```java
59-
jplotlib.scatter(x, y).build();
59+
jplotlib.scatter(x, y);
6060
```
6161

6262
You can find more information about scatter plots in the [SCATTER.md](SCATTER.md) document.
@@ -69,7 +69,7 @@ To create a 2D bar graph using Jplotlib, follow the same initial steps and then
6969
String[] xLabels = {"A", "B", "C", "D"};
7070
double[] yData = {25.0, 42.0, 30.5, 18.7};
7171

72-
jplotlib.bar(xLabels, yData).build();
72+
jplotlib.bar(xLabels, yData);
7373
```
7474

7575
For more details and options for bar graphs, refer to the [BAR.md](BAR.md) document.
@@ -83,7 +83,7 @@ To create a 2D pie chart using Jplotlib, follow the same initial steps and then
8383
```java
8484
double[] dataPoints = {35.0, 25.0, 15.0, 25.0};
8585

86-
jplotlib.pie(dataPoints).build();
86+
jplotlib.pie(dataPoints);
8787
```
8888

8989
More information about pie charts can be found in the [PIE.md](PIE.md) document.

docs/LIB_COLOR.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# LibColor Enum
2+
3+
The `LibColor` enum in Jplotlib provides a set of predefined colors that you can use to customize the appearance of your plots.
4+
5+
### Available LibColor:
6+
7+
- `LibColor.BLUE`
8+
- `LibColor.ORANGE`
9+
- `LibColor.GREEN`
10+
- `LibColor.RED`
11+
- `LibColor.PURPLE`
12+
- `LibColor.BROWN`
13+
- `LibColor.PINK`
14+
- `LibColor.GREY`
15+
- `LibColor.LIME`
16+
- `LibColor.SKY`
17+
18+
### Example Usage:
19+
20+
```java
21+
import io.github.manishdait.jplotlib.Jplotlib;
22+
import io.github.manishdait.jplotlib.defaults.color.LibColor;
23+
import io.github.manishdait.jplotlib.defaults.marker.Marker;
24+
25+
public class App {
26+
public static void main(String[] args) {
27+
double[] y1 = {0, 3, 4, 7};
28+
double[] y2 = {2.5, 5.1, 3.9, 6.2};
29+
30+
Jplotlib jplotlib = new Jplotlib();
31+
jplotlib.plot(y1)
32+
.marker(Marker.CIRCLE)
33+
.markerColor(LibColor.GREEN.getColor());
34+
jplotlib.plot(y2)
35+
.marker(Marker.SQUARE)
36+
.markerColor(Color.MAGENTA);
37+
jplotlib.show();
38+
}
39+
}
40+
```
41+
In this example, we use the `.color(LibColor.BLUE.getColor())` method to set the line color to blue and `.markerColor(LibColor.RED.getColor())` to set marker color red using `LibColor` from Jplotlib. The `LibColor.BLUE` constant provides the predefined blue color and `LibColor.RED` constant provides predefine red color.
42+
43+
<img src="assets/marker/marker_EG2.png" alt="base_stroke_eg1.png" width="620px">
44+
45+
You can use any of the available LibColor constants to customize the color of lines, markers, or other visual elements in your plot according to your preferences.
46+
47+

docs/MARKER.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Currently, Jplotlib provides three marker types:
1818

1919
```java
2020
import io.github.manishdait.jplotlib.Jplotlib;
21-
import io.github.manishdait.jplotlib.style.marker.BaseMarker;
21+
import io.github.manishdait.jplotlib.defaults.marker.Marker;
2222

2323
public class App {
2424
public static void main(String[] args) {
@@ -28,36 +28,33 @@ public class App {
2828

2929
Jplotlib jplotlib = new Jplotlib();
3030
jplotlib.plot(y1)
31-
.marker(BaseMarker.NONE)
32-
.build();
31+
.marker(Marker.NONE);
3332
jplotlib.plot(y2)
34-
.marker(BaseMarker.CIRCLE)
35-
.build();
33+
.marker(Marker.CIRCLE);
3634
jplotlib.plot(y3)
37-
.marker(BaseMarker.SQUARE)
38-
.build();
35+
.marker(Marker.SQUARE);
3936
jplotlib.show();
4037
}
4138
}
4239
```
4340

44-
In above example we use `.marker(BaseMarker.Circle)` to set marker as circle , `.marker(BaseMarker.Square)` to set marker as square and `.marker(BaseMarker.NONE)` to set no marker, `BaseMarker.NONE` is the default marker style.
41+
In above example we use `.marker(Marker.Circle)` to set marker as circle , `.marker(Marker.Square)` to set marker as square and `.marker(Marker.NONE)` to set no marker, `Marker.NONE` is the default marker style.
4542

46-
<img src="assets/marker/marker_eg1.png" alt="marker_eg1.png" width="620px">
43+
<img src="assets/marker/marker_EG1.png" alt="marker_eg1.png" width="620px">
4744

4845

4946
### Setting Marker Color:
5047

51-
You can customize the color of the markers using the `.markerColor()` method. This method accepts either the `BaseColor` enum or `java.awt.Color`. You can find the available colors in the [BaseColor Enum section](BASE_COLOR.md) below.
48+
You can customize the color of the markers using the `.markerColor()` method. This method accepts either the `LibColor` enum or `java.awt.Color`. You can find the available colors in the [LibColor Enum section](LIB_COLOR.md) below.
5249

5350
### Example Usage:
5451

5552
```java
5653
import java.awt.Color;
5754

5855
import io.github.manishdait.jplotlib.Jplotlib;
59-
import io.github.manishdait.jplotlib.style.color.BaseColor;
60-
import io.github.manishdait.jplotlib.style.marker.BaseMarker;
56+
import io.github.manishdait.jplotlib.defaults.color.LibColor;
57+
import io.github.manishdait.jplotlib.defaults.marker.Marker;
6158

6259
public class App {
6360
public static void main(String[] args) {
@@ -66,20 +63,18 @@ public class App {
6663

6764
Jplotlib jplotlib = new Jplotlib();
6865
jplotlib.plot(y1)
69-
.marker(BaseMarker.CIRCLE)
70-
.markerColor(BaseColor.GREEN.getColor())
71-
.build();
66+
.marker(Marker.CIRCLE)
67+
.markerColor(LibColor.GREEN.getColor());
7268
jplotlib.plot(y2)
73-
.marker(BaseMarker.SQUARE)
74-
.markerColor(Color.MAGENTA)
75-
.build();
69+
.marker(Marker.SQUARE)
70+
.markerColor(Color.MAGENTA);
7671
jplotlib.show();
7772
}
7873
}
7974
```
80-
In above we use `.markerColor(BaseColor.GREEN.getColor())` method to set the marker color to green using the `BaseColor` enum and `.markerColor(Color.MAGENTA)` from java.awt.Color.
75+
In above we use `.markerColor(LibColor.GREEN.getColor())` method to set the marker color to green using the `LibColor` enum and `.markerColor(Color.MAGENTA)` from java.awt.Color.
8176

82-
<img src="assets/marker/marker_eg2.png" alt="marker_eg2.png" width="620px">
77+
<img src="assets/marker/marker_EG2.png" alt="marker_eg2.png" width="620px">
8378

8479

8580
### Setting Marker Size:
@@ -90,7 +85,7 @@ To adjust the size of the markers, you can use the `.markerSize()` method, which
9085

9186
```java
9287
import io.github.manishdait.jplotlib.Jplotlib;
93-
import io.github.manishdait.jplotlib.style.marker.BaseMarker;
88+
import io.github.manishdait.jplotlib.defaults.marker.Marker;
9489

9590
public class App {
9691
public static void main(String[] args) {
@@ -99,20 +94,18 @@ public class App {
9994

10095
Jplotlib jplotlib = new Jplotlib();
10196
jplotlib.plot(y1)
102-
.marker(BaseMarker.CIRCLE)
103-
.markerSize(4)
104-
.build();
97+
.marker(Marker.CIRCLE)
98+
.markerSize(4);
10599
jplotlib.plot(y2)
106-
.marker(BaseMarker.SQUARE)
107-
.markerSize(10)
108-
.build();
100+
.marker(Marker.SQUARE)
101+
.markerSize(10);
109102
jplotlib.show();
110103
}
111104
}
112105
```
113106

114107
In above we use `.markerSize(4)` and `.markerSize(10)` to set marker size and 4 and 10 respectivly.
115108

116-
<img src="assets/marker/marker_eg3.png" alt="marker_eg3.png" width="620px">
109+
<img src="assets/marker/marker_EG3.png" alt="marker_eg3.png" width="620px">
117110

118111
You can use the `.marker()` feature to enhance the visibility of data points in your plots and tailor the markers according to your preferences.

0 commit comments

Comments
 (0)