{"id":3486,"date":"2016-08-22T07:28:04","date_gmt":"2016-08-22T07:28:04","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=3486"},"modified":"2016-08-22T08:21:35","modified_gmt":"2016-08-22T08:21:35","slug":"marking-internals-in-gnuplot-graph-with-shading","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2016\/08\/marking-internals-in-gnuplot-graph-with-shading\/","title":{"rendered":"Marking intervals in gnuplot graph (with shading)"},"content":{"rendered":"<p><a href=\"http:\/\/41j.com\/blog\/2016\/08\/marking-internals-in-gnuplot-graph-with-shading\/data\/\" rel=\"attachment wp-att-3487\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3487\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2016\/08\/data.png\" alt=\"data\" width=\"500\" height=\"350\" \/><\/a><\/p>\n<p>I needed to mark intervals on a gnuplot line plot different colors. Critically, I didn&#8217;t want to have to set the y start and end points (as you would if just drawing a rectangle). Turns out you can do this in gnuplot with a rect object and it&#8217;ll figure it out, such that it covers the graph area.<\/p>\n<p>Example code is below (the &#8220;data&#8221; data file should contain x y datapoints 1 set per line in this example):<\/p>\n<pre>\r\nset terminal postscript eps color\r\nset output \"data.eps\"\r\n\r\nset xlabel \"Time\"\r\nset ylabel \"Magnitude\"\r\n\r\nset xrange [0:330]\r\n\r\nset style rect fc lt -1 fs solid 0.15 noborder\r\nset obj rect from 240, graph 0 to 270, graph 1 fc rgbcolor \"red\"\r\nset obj rect from 360, graph 0 to 390, graph 1 fc rgbcolor \"red\"\r\nset obj rect from 420, graph 0 to 450, graph 1 fc rgbcolor \"red\"\r\nset obj rect from 540, graph 0 to 570, graph 1 fc rgbcolor \"red\"\r\nset obj rect from 720, graph 0 to 750, graph 1 fc rgbcolor \"red\"\r\n\r\nset style rect fc rgbcolor \"yellow\"\r\nset obj rect from 60, graph 0 to 90, graph 1\r\nset obj rect from 120, graph 0 to 150, graph 1\r\nset obj rect from 180, graph 0 to 210, graph 1\r\nset obj rect from 300, graph 0 to 330, graph 1\r\n\r\nplot \"data\" u 1:2 with lines\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I needed to mark intervals on a gnuplot line plot different colors. Critically, I didn&#8217;t want to have to set the y start and end points (as you would if just drawing a rectangle). Turns out you can do this in gnuplot with a rect object and it&#8217;ll figure it out, such that it covers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-3486","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-Ue","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/3486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=3486"}],"version-history":[{"count":4,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/3486\/revisions"}],"predecessor-version":[{"id":3494,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/3486\/revisions\/3494"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=3486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=3486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=3486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}