• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ac-i2i-engineering / MatPlus / 13358236527

16 Feb 2025 07:45PM UTC coverage: 87.671% (+87.7%) from 0.0%
13358236527

Pull #6

github

BestLocation
Removed unnessary refrences
Pull Request #6: Added 2 objects and testing

129 of 131 new or added lines in 4 files covered. (98.47%)

192 of 219 relevant lines covered (87.67%)

7.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.29
/MatPlus/ScatterPlot.py
1
import matplotlib.pyplot as plt
6✔
2
import numpy as np
6✔
3

4
class ScatterPlot():
6✔
5
    def __init__(self,x,y,lowerlimx = None,lowerlimy = None, upperlimx = None, upperlimy = None, sizes = [], colors = [], vmin = 0, vmax = 0,width = 1):
6✔
6
        """Initializes Scatterplot object with the following parameters:
7
        type: type of the plot
8
        x: x-axis data
9
        y: y-axis data
10
        lowerlimx: lower limit of x-axis
11
        lowerlimy: lower limit of y-axis
12
        upperlimx: upper limit of x-axis
13
        upperlimy: upper limit of y-axis
14
        sizes: size of the data points
15
        colors: color of the data points
16
        vmin: minimum value of the color map
17
        vmax: maximum value of the color map
18
        """
19
        
20
        self.type = type
6✔
21
        self.x = x
6✔
22
        self.y = y
6✔
23
        self.lowerlimx = lowerlimx
6✔
24
        self.lowerlimy = lowerlimy
6✔
25
        self.upperlimx = upperlimx
6✔
26
        self.upperlimy = upperlimy
6✔
27
        self.sizes = sizes
6✔
28
        self.colors = colors
6✔
29
        self.vmin = vmin
6✔
30
        self.vmax = vmax
6✔
31
        self.width = width
6✔
32
        if self.lowerlimx is None:
6✔
33
            self.lowerlimx = np.min(x) * 0.9
6✔
34
        if self.lowerlimy is None:
6✔
35
            self.lowerlimy = np.min(y) * 0.9
6✔
36
        if self.upperlimx is None:
6✔
37
            self.upperlimx = np.max(x) * 1.1
6✔
38
        if self.upperlimy is None:
6✔
39
            self.upperlimy = np.max(y) * 1.1
6✔
40

41
    
42
    def plot(self):
6✔
43
        """Plots the scatter plot with the given parameters"""
44
        fig, ax = plt.subplots()
6✔
45
        if(len(self.sizes) != 0 and len(self.colors) != 0):
6✔
NEW
46
            ax.scatter(self.x, self.y, s=self.sizes, c=self.colors, vmin=self.vmin, vmax=self.vmax)
×
47
        elif(len(self.sizes) != 0):
6✔
NEW
48
            ax.scatter(self.x, self.y, s=self.sizes, vmin=self.vmin, vmax=self.vmax)
×
49
        else:
50
            ax.scatter(self.x, self.y, s = 20, vmin=self.vmin, vmax=self.vmax)
6✔
51
        plt.xlabel('X-axis')
6✔
52
        plt.ylabel('Y-axis')
6✔
53
        ax.set(xlim=(self.lowerlimx, self.upperlimx), xticks=np.arange(self.lowerlimx+1, self.upperlimx),
6✔
54
        ylim=(self.lowerlimy, self.upperlimy), yticks=np.arange(self.lowerlimy+1, self.upperlimy))
55
        plt.show()
6✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc