{"id":24848,"date":"2024-03-16T03:57:54","date_gmt":"2024-03-16T03:57:54","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/"},"modified":"2024-03-22T04:44:30","modified_gmt":"2024-03-22T04:44:30","slug":"detailed-explanation-of-the-matlab-plotyy-function","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/","title":{"rendered":"Detailed explanation of the MATLAB plotyy function."},"content":{"rendered":"<p>The plotyy function in Matlab is used for plotting two different datasets on the same graph, allowing them to be displayed on separate y-axes.<\/p>\n<p>The basic syntax of the plotyy function is:<\/p>\n<pre class=\"post-pre\"><code>plotyy(x1, y1, x2, y2)\r\n<\/code><\/pre>\n<p>Here, x1 and y1 are the x and y-axis data of the first dataset, and x2 and y2 are the x and y-axis data of the second dataset.<\/p>\n<p>The plot created using the plotyy function will automatically generate two y-axes, with the first dataset plotted on the left y-axis and the second dataset plotted on the right y-axis.<\/p>\n<p>In addition to basic grammar, the plotyy function also supports some optional parameters for setting the style and properties of the graph, for example:<\/p>\n<ol>\n<li>&#8216;LineStyle&#8217;: specifies the type of line for the curve, which can be solid (&#8220;-&#8220;) or dashed (&#8220;&#8211;&#8220;) and so on.<\/li>\n<li>&#8216;Color&#8217;: Define the color of the curve.<\/li>\n<li>&#8216;Marker&#8217;: The symbol used to represent points on a curve, such as a circle (&#8220;o&#8221;) or asterisk (&#8220;*&#8221;).<\/li>\n<li>&#8216;Set the size of the marker symbols for the curve.&#8217;<\/li>\n<li>\u2018Parent\u2019 refers to the specified parent object for drawing, which can be a figure object or an axes object.<\/li>\n<\/ol>\n<p>Here is an example code utilizing the plotyy function to plot two data sets.<\/p>\n<pre class=\"post-pre\"><code>x = <span class=\"hljs-built_in\">linspace<\/span>(<span class=\"hljs-number\">0<\/span>,<span class=\"hljs-number\">10<\/span>,<span class=\"hljs-number\">100<\/span>);\r\ny1 = <span class=\"hljs-built_in\">sin<\/span>(x);\r\ny2 = <span class=\"hljs-built_in\">cos<\/span>(x);\r\n\r\n[ax, h1, h2] = plotyy(x, y1, x, y2);\r\nxlabel(<span class=\"hljs-string\">'x'<\/span>);\r\nylabel(ax(<span class=\"hljs-number\">1<\/span>), <span class=\"hljs-string\">'sin(x)'<\/span>);\r\nylabel(ax(<span class=\"hljs-number\">2<\/span>), <span class=\"hljs-string\">'cos(x)'<\/span>);\r\ntitle(<span class=\"hljs-string\">'Plotyy Example'<\/span>);\r\n<\/code><\/pre>\n<p>This code will plot a graph with two curves, where the left y-axis shows the curve of sin(x) and the right y-axis shows the curve of cos(x). The graph also includes x-axis labels, y-axis labels, and a title.<\/p>\n<p>In summary, the plotyy function in Matlab is used to plot two sets of data on separate y-axes. Different styles and properties of the curves can be set using optional parameters.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The plotyy function in Matlab is used for plotting two different datasets on the same graph, allowing them to be displayed on separate y-axes. The basic syntax of the plotyy function is: plotyy(x1, y1, x2, y2) Here, x1 and y1 are the x and y-axis data of the first dataset, and x2 and y2 are [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-24848","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Detailed explanation of the MATLAB plotyy function. - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Detailed explanation of the MATLAB plotyy function.\" \/>\n<meta property=\"og:description\" content=\"The plotyy function in Matlab is used for plotting two different datasets on the same graph, allowing them to be displayed on separate y-axes. The basic syntax of the plotyy function is: plotyy(x1, y1, x2, y2) Here, x1 and y1 are the x and y-axis data of the first dataset, and x2 and y2 are [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-16T03:57:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-22T04:44:30+00:00\" \/>\n<meta name=\"author\" content=\"Isabella Edwards\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Isabella Edwards\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\"},\"author\":{\"name\":\"Isabella Edwards\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/5579144e23c225c8188167f3e3f888dd\"},\"headline\":\"Detailed explanation of the MATLAB plotyy function.\",\"datePublished\":\"2024-03-16T03:57:54+00:00\",\"dateModified\":\"2024-03-22T04:44:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\"},\"wordCount\":279,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\",\"name\":\"Detailed explanation of the MATLAB plotyy function. - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2024-03-16T03:57:54+00:00\",\"dateModified\":\"2024-03-22T04:44:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Detailed explanation of the MATLAB plotyy function.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/5579144e23c225c8188167f3e3f888dd\",\"name\":\"Isabella Edwards\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4d4dec47f553ac7961d9fa4cc9bdcdcf5b7ce5106594330b6d25c5694fdbaec?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4d4dec47f553ac7961d9fa4cc9bdcdcf5b7ce5106594330b6d25c5694fdbaec?s=96&d=mm&r=g\",\"caption\":\"Isabella Edwards\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/isabellaedwards\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Detailed explanation of the MATLAB plotyy function. - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/","og_locale":"en_US","og_type":"article","og_title":"Detailed explanation of the MATLAB plotyy function.","og_description":"The plotyy function in Matlab is used for plotting two different datasets on the same graph, allowing them to be displayed on separate y-axes. The basic syntax of the plotyy function is: plotyy(x1, y1, x2, y2) Here, x1 and y1 are the x and y-axis data of the first dataset, and x2 and y2 are [&hellip;]","og_url":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2024-03-16T03:57:54+00:00","article_modified_time":"2024-03-22T04:44:30+00:00","author":"Isabella Edwards","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"Isabella Edwards","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/"},"author":{"name":"Isabella Edwards","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/5579144e23c225c8188167f3e3f888dd"},"headline":"Detailed explanation of the MATLAB plotyy function.","datePublished":"2024-03-16T03:57:54+00:00","dateModified":"2024-03-22T04:44:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/"},"wordCount":279,"commentCount":0,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/","url":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/","name":"Detailed explanation of the MATLAB plotyy function. - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2024-03-16T03:57:54+00:00","dateModified":"2024-03-22T04:44:30+00:00","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/detailed-explanation-of-the-matlab-plotyy-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Detailed explanation of the MATLAB plotyy function."}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/5579144e23c225c8188167f3e3f888dd","name":"Isabella Edwards","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4d4dec47f553ac7961d9fa4cc9bdcdcf5b7ce5106594330b6d25c5694fdbaec?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4d4dec47f553ac7961d9fa4cc9bdcdcf5b7ce5106594330b6d25c5694fdbaec?s=96&d=mm&r=g","caption":"Isabella Edwards"},"url":"https:\/\/www.silicloud.com\/blog\/author\/isabellaedwards\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/24848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=24848"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/24848\/revisions"}],"predecessor-version":[{"id":58908,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/24848\/revisions\/58908"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=24848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=24848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=24848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}