Skip to content

Plot with dashed lines#148

Open
zhongjingjogy wants to merge 7 commits intotrase-cpp:masterfrom
zhongjingjogy:master
Open

Plot with dashed lines#148
zhongjingjogy wants to merge 7 commits intotrase-cpp:masterfrom
zhongjingjogy:master

Conversation

@zhongjingjogy
Copy link
Copy Markdown

Try to plot with dashed lines.
test_lines96

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 29, 2022

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.67%. Comparing base (a400fe0) to head (dcaeb78).

Files with missing lines Patch % Lines
src/util/Style.cpp 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhongjingjogy
Copy link
Copy Markdown
Author

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!

Copy link
Copy Markdown
Collaborator

@martinjrobins martinjrobins left a 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

Comment thread src/frontend/Axis.hpp
}

// get the number of maximum char length of yticks
int max_ytick_char_len() const { return m_max_ytick_char_len; }
Copy link
Copy Markdown
Collaborator

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

Comment thread src/frontend/Axis.hpp
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(); }
Copy link
Copy Markdown
Collaborator

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.

Comment thread src/frontend/Axis.hpp
float font_size() const { return m_style.font_size(); }

// get maximum char
std::string max_ytick_char() const { return m_max_ytick_char; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

and remove this

Comment thread src/frontend/Axis.tcc

backend.text_align(ALIGN_RIGHT | ALIGN_MIDDLE);

size_t max_char_len = this->max_ytick_char_len();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
size_t max_char_len = this->max_ytick_char_len();
size_t max_char_len = 0;

Comment thread src/frontend/Axis.tcc

if (strlen(buffer) > max_char_len) {
max_char_len = strlen(buffer);
m_max_ytick_char = std::string(buffer);
Copy link
Copy Markdown
Collaborator

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

Comment thread src/frontend/Axis.hpp
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 {
Copy link
Copy Markdown
Collaborator

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

Comment thread tests/TestAxis.cpp


TEST_CASE("ylabel position: case 1", "[axis]") {
std::vector<double> predicted_data = {
Copy link
Copy Markdown
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants