-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plot with dashed lines #148
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #148 +/- ##
==========================================
+ Coverage 87.60% 87.67% +0.07%
==========================================
Files 47 47
Lines 2146 2167 +21
==========================================
+ Hits 1880 1900 +20
- Misses 266 267 +1
Continue to review full report at Codecov.
|
It seems that the last pull request was not merged. I wonder if the current pull request is acceptable or not. Looking for the positive response. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zhongjingjogy. The previous PR was still in progress, so I'm not sure why you closed it! The new line styles look good, just a few things to tidy up see comments below
} | ||
|
||
// get the number of maximum char length of yticks | ||
int max_ytick_char_len() const { return m_max_ytick_char_len; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_max_ytick_char_len
depends on if the drawing code is run yet or not. please remove this method and keep this value purely private to the class
int max_ytick_char_len() const { return m_max_ytick_char_len; } | ||
|
||
// get default font size | ||
float font_size() const { return m_style.font_size(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this too as is not needed.
float font_size() const { return m_style.font_size(); } | ||
|
||
// get maximum char | ||
std::string max_ytick_char() const { return m_max_ytick_char; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and remove this
@@ -96,18 +98,28 @@ template <typename Backend> void Axis::draw_common_ticks(Backend &backend) { | |||
|
|||
backend.text_align(ALIGN_RIGHT | ALIGN_MIDDLE); | |||
|
|||
size_t max_char_len = this->max_ytick_char_len(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t max_char_len = this->max_ytick_char_len(); | |
size_t max_char_len = 0; |
|
||
if (strlen(buffer) > max_char_len) { | ||
max_char_len = strlen(buffer); | ||
m_max_ytick_char = std::string(buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think m_max_ytick_char
is not used? If so then remove
@@ -219,6 +223,22 @@ class Axis : public Drawable { | |||
/// gets the number of ticks on this axis | |||
Vector<int, 2> get_ticks() const { return {m_nx_ticks, m_ny_ticks}; } | |||
|
|||
/// get the number of maximum yticks length (in pixels) | |||
int max_ytick_pixels() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation should really be done by the Style
class, but since the calculation is still not correct please put it inline in Axis::draw_common_ylabel
along with a TODO comment
|
||
|
||
TEST_CASE("ylabel position: case 1", "[axis]") { | ||
std::vector<double> predicted_data = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename these vectors x and y and use these below rather than creating another pair of vectors
Try to plot with dashed lines.
![test_lines96](https://user-images.githubusercontent.com/9261231/181658218-1be863a5-7ce6-440b-837b-69868f441724.svg)