{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Dario Radečić",
  "title_listed": "5 PCA Visualizations You Must Try On Your Next Data Science Project",
  "keywords": "PCA,降维,可视化",
  "domain": "机器学习",
  "content_type": "深度技术解析",
  "is_paid_flag": "部分免费/会员墙",
  "url": "https://towardsdatascience.com/5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d/",
  "publish_date": "2024-08",
  "corpus_stage": "预训练/SFT",
  "notes": "",
  "id": "6907259ffe3a",
  "collected_at": "2026-10-01T20:57:24",
  "title": "5 PCA Visualizations You Must Try On Your Next Data Science Project | Towards Data Science",
  "body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Data Science](https://towardsdatascience.com/category/data-science/)\n# 5 PCA Visualizations You Must Try On Your Next Data Science Project\nWhich features carry the most weight? How do original features contribute to principal components? These 5 visualization types have the...\n[Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nAugust 2, 20248 min read\n### Which features carry the most weight? How do original features contribute to principal components? These 5 visualization types have the answer.\n![Photo by Andrew Neel on Unsplash](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/0ovHhFWEqO1P0Cm4u-scaled.jpg)\nPhoto by [Andrew Neel](https://unsplash.com/@andrewtneel?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)\nPrincipal Component Analysis (PCA) can tell you a lot about your data. In short, it's a dimensionality reduction technique used to bring high-dimensional datasets into a space that can be visualized.\n**But I assume you already know that.** If not, check my [from-scratch guide](https://towardsdatascience.com/principal-component-analysis-pca-from-scratch-in-python-7f3e2a540c51).\nToday, we only care about the visuals. By the end of the article, you'll know how to create and interpret:\n  1. Explained variance plot\n  2. Cumulative explained variance plot\n  3. 2D/3D component scatter plot\n  4. Attribute biplot\n  5. Loading score plot\n\n\nLearn this step by step with the interactive [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Machine Learning](https://roadmap.sh/machine-learning) and [Data Analyst](https://roadmap.sh/data-analyst) roadmaps.\n## Getting Started - PCA Visualization Prerequisites\nI'd love to dive into visualizations right away, but you'll need data to follow along. This section covers data loading, preprocessing, PCA fitting, and general Matplotlib styling tweaks.\n### Dataset Info\nI'm using the [Wine Quality Dataset](https://www.kaggle.com/datasets/yasserh/wine-quality-dataset). It's available for free on Kaggle and is licensed under the [Creative Commons License](https://creativecommons.org/publicdomain/zero/1.0/).\nThis is what you should see after loading it with Python:\npython\n\n```\nimport numpy as np\nimport pandas as pd\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.decomposition import PCA\n\ndata = pd.read_csv(\"data/WineQT.csv\")\ndata.drop([\"Id\"], axis=1, inplace=True)\ndata.head()\n```\n\n![Image 1 - Head of the Wine quality dataset \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1qi0aYSKWOP90J7l3tzh2pQ.png)\nImage 1 - Head of the Wine quality dataset (image by author)\nPCA assumes numerical features with no missing values located around 0 with a standard deviation of 1:\npython\n\n```\nX = data.drop(\"quality\", axis=1)\ny = data[\"quality\"]\n\nX_scaled = StandardScaler().fit_transform(X)\n\npca = PCA().fit(X_scaled)\npca_res = pca.transform(X_scaled)\n\npca_res_df = pd.DataFrame(pca_res, columns=[f\"PC{i}\" for i in range(1, pca_res.shape[1] + 1)])\npca_res_df.head()\n```\n\n![Image 2 - Wine quality dataset after applying PCA \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1WGwcO9y38Cw1H_OuPoFHdA.png)\nImage 2 - Wine quality dataset after applying PCA (image by author)\nThe dataset is now ready for visualization, but any chart you make will look horrendous at best. Let's fix that.\n### Matplotlib Visualization Tweaks\nI have a full-length article covering [Matplotlib styling tweaks](https://betterdatascience.com/top-3-matplotlib-tips/), so don't expect any depth here.\nDownload a TTF font of your choice to follow along (mine is [Roboto Condensed](https://fonts.google.com/specimen/Roboto+Condensed)) and replace the path in `font_dir` to match one on your operating system:\npython\n\n```\nimport matplotlib.pyplot as plt\nimport matplotlib.font_manager as font_manager\n\nimport matplotlib_inline\nmatplotlib_inline.backend_inline.set_matplotlib_formats(\"svg\")\n\nfont_dir = [\"Roboto_Condensed\"]\nfor font in font_manager.findSystemFonts(font_dir):\n    font_manager.fontManager.addfont(font)\n\nplt.rcParams[\"figure.figsize\"] = 10, 6\nplt.rcParams[\"axes.spines.top\"] = False\nplt.rcParams[\"axes.spines.right\"] = False\nplt.rcParams[\"font.size\"] = 14\nplt.rcParams[\"figure.titlesize\"] = \"xx-large\"\nplt.rcParams[\"xtick.labelsize\"] = \"medium\"\nplt.rcParams[\"ytick.labelsize\"] = \"medium\"\nplt.rcParams[\"axes.axisbelow\"] = True\nplt.rcParams[\"font.family\"] = \"Roboto Condensed\"\n```\n\nYou'll now get modern-looking high-resolution charts any time you plot something.\nAnd that's all you need to start making awesome PCA visualizations. Let's dive into the first one next.\n## PCA Plot #1: Explained Variance Plot\n**Question:** How much of the total variance in the data is captured by each principal component?\nIf you're wondering the same, the explained variance plot is where it's at. You'll typically see the first couple of components covering a decent chunk of the overall variance, but that might depend on the number of features you're starting with.\nThe first component of a dataset with 5 features will capture more total variance than the first component of a dataset with 500 features - duh.\npython\n\n```\nplot_y = [val * 100 for val in pca.explained_variance_ratio_]\nplot_x = range(1, len(plot_y) + 1)\n\nbars = plt.bar(plot_x, plot_y, align=\"center\", color=\"#1C3041\", edgecolor=\"#000000\", linewidth=1.2)\nfor bar in bars:\n    yval = bar.get_height()\n    plt.text(bar.get_x() + bar.get_width() / 2, yval + 0.001, f\"{yval:.1f}%\", ha=\"center\", va=\"bottom\")\n\nplt.xlabel(\"Principal Component\")\nplt.ylabel(\"Percentage of Explained Variance\")\nplt.title(\"Variance Explained per Principal Component\", loc=\"left\", fontdict={\"weight\": \"bold\"}, y=1.06)\nplt.grid(axis=\"y\")\nplt.xticks(plot_x)\n\nplt.show()\n```\n\n![Image 3 - Explained variance plot \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1r5UVsuNgOT_ZQnF7fQOmsw.png)\nImage 3 - Explained variance plot (image by author)\n28.7% of total variance (from 11 features) is explained with just one component. In other words, you can plot the entire dataset on a single line (1D) and still show ~ a third of the variability.\n## PCA Plot #2: Cumulative Explained Variance Plot\n**Question:** I want to reduce the dimensionality of my data, but still want to keep at least 90% of the variance. What should I do?\nThe simplest answer is to modify the first chart so it shows the cumulative sum of explained variance. In code, just iteratively sum up the values up to the current item.\npython\n\n```\nexp_var = [val * 100 for val in pca.explained_variance_ratio_]\nplot_y = [sum(exp_var[:i+1]) for i in range(len(exp_var))]\nplot_x = range(1, len(plot_y) + 1)\n\nplt.plot(plot_x, plot_y, marker=\"o\", color=\"#9B1D20\")\nfor x, y in zip(plot_x, plot_y):\n    plt.text(x, y + 1.5, f\"{y:.1f}%\", ha=\"center\", va=\"bottom\")\n\nplt.xlabel(\"Principal Component\")\nplt.ylabel(\"Cumulative Percentage of Explained Variance\")\nplt.title(\"Cumulative Variance Explained per Principal Component\", loc=\"left\", fontdict={\"weight\": \"bold\"}, y=1.06)\n\nplt.yticks(range(0, 101, 5))\nplt.grid(axis=\"y\")\nplt.xticks(plot_x)\n\nplt.show()\n```\n\n![Image 4 - Cumulative explained variance plot \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1CJpQTNpAs5z-K3Z8d3kkjw.png)\nImage 4 - Cumulative explained variance plot (image by author)\nSo, if you want a narrower dataset that still captures at least 90% of the variance, you'll want to keep the first 7 principal components.\n## PCA Plot #3: 2D/3D Component Scatter Plot\n**Question** : How can I visualize the relationship between records of a high-dimensional dataset? We can't see more than 3 dimensions at a time.\nA scatter plot of the first 2 or 3 principal components is what you're looking for. Ideally, you should color the data points with distinct values of the target variable (assuming a classification dataset).\nLet's break it down.\n### 2D Scatter Plot\nThe first two components capture ~ 45% of the variance. It's a decent amount, but a 2-dimensional scatter plot still won't account for more than half of it. Something to keep in mind.\npython\n\n```\ntotal_explained_variance = sum(pca.explained_variance_ratio_[:2]) * 100\ncolors = [\"#1C3041\", \"#9B1D20\", \"#0B6E4F\", \"#895884\", \"#F07605\", \"#F5E400\"]\n\npca_2d_df = pd.DataFrame(pca_res[:, :2], columns=[\"PC1\", \"PC2\"])\npca_2d_df[\"y\"] = data[\"quality\"]\n\nfig, ax = plt.subplots()\nfor i, target in enumerate(sorted(pca_2d_df[\"y\"].unique())):\n    subset = pca_2d_df[pca_2d_df[\"y\"] == target]\n    ax.scatter(x=subset[\"PC1\"], y=subset[\"PC2\"], s=70, alpha=0.7, c=colors[i], edgecolors=\"#000000\", label=target)\n\nplt.xlabel(\"Principal Component 1\")\nplt.ylabel(\"Principal Component 2\")\nplt.title(f\"Wine Quality Dataset PCA ({total_explained_variance:.2f}% Explained Variance)\", loc=\"left\", fontdict={\"weight\": \"bold\"}, y=1.06)\n\nax.legend(title=\"Wine quality\")\nplt.show()\n```\n\n![Image 5 - Scatter plot of the first two principal components \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1znk99dwXbjK9d-hyQroKow.png)\nImage 5 - Scatter plot of the first two principal components (image by author)\nIt's a mess, so let's try adding a dimension.\n### 3D Scatter Plot\nAdding an extra dimension will increase the explained variance to ~ 60%. Keep in mind that 3D charts are more challenging to look at, and the interpretation can somewhat depend on the chart's angle.\npython\n\n```\ntotal_explained_variance = sum(pca.explained_variance_ratio_[:3]) * 100\ncolors = [\"#1C3041\", \"#9B1D20\", \"#0B6E4F\", \"#895884\", \"#F07605\", \"#F5E400\"]\n\npca_3d_df = pd.DataFrame(pca_res[:, :3], columns=[\"PC1\", \"PC2\", \"PC3\"])\npca_3d_df[\"y\"] = data[\"quality\"]\n\nfig = plt.figure(figsize=(10, 10))\nax = fig.add_subplot(projection=\"3d\")\n\nfor i, target in enumerate(sorted(pca_3d_df[\"y\"].unique())):\n    subset = pca_3d_df[pca_3d_df[\"y\"] == target]\n    ax.scatter(xs=subset[\"PC1\"], ys=subset[\"PC2\"], zs=subset[\"PC3\"], s=70, alpha=0.7, c=colors[i], edgecolors=\"#000000\", label=target)\n\nax.set_xlabel(\"Principal Component 1\")\nax.set_ylabel(\"Principal Component 2\")\nax.set_zlabel(\"Principal Component 3\")\nax.set_title(f\"Wine Quality Dataset PCA ({total_explained_variance:.2f}% Explained Variance)\", loc=\"left\", fontdict={\"weight\": \"bold\"})\n\nax.legend(title=\"Wine quality\", loc=\"lower left\")\nplt.show()\n```\n\n![Image 6 - Scatter plot of the first three principal components \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/13WKUz_i-RVpy7TXgKJVxlA.png)\nImage 6 - Scatter plot of the first three principal components (image by author)\nTo change the perspective, you can play around with the [view_init()](https://matplotlib.org/stable/api/_as_gen/mpl_toolkits.mplot3d.axes3d.Axes3D.view_init.html) function. It allows you to change the elevation and azimuth of the axes in degrees:\nxml\n\n```\nax.view_init(elev=<value>, azim=<value>)\n```\n\n![Image 7 - Tweaking 3D scatter plot angle \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1HlSzXYNf7gzpdBhYRWLheg.gif)\nImage 7 - Tweaking 3D scatter plot angle (image by author)\nOr, you can use an interactive charting library like Plotly and rotate the chart like a sane person.\n## PCA Plot #4: Biplot\n**Question:** Can I see how the original variables contribute to and correlate with the principal components?\nYup. Annoyingly, this chart type is much easier to make in R, but what can you do.\npython\n\n```\nlabels = X.columns\nn = len(labels)\ncoeff = np.transpose(pca.components_)\npc1 = pca.components_[:, 0]\npc2 = pca.components_[:, 1]\n\nplt.figure(figsize=(8, 8))\n\nfor i in range(n):\n    plt.arrow(x=0, y=0, dx=coeff[i, 0], dy=coeff[i, 1], color=\"#000000\", width=0.003, head_width=0.03)\n    plt.text(x=coeff[i, 0] * 1.15, y=coeff[i, 1] * 1.15, s=labels[i], size=13, color=\"#000000\", ha=\"center\", va=\"center\")\n\nplt.axis(\"square\")\nplt.title(f\"Wine Quality Dataset PCA Biplot\", loc=\"left\", fontdict={\"weight\": \"bold\"}, y=1.06)\nplt.xlabel(\"Principal Component 1\")\nplt.ylabel(\"Principal Component 2\")\n\nplt.xlim(-1, 1)\nplt.ylim(-1, 1)\nplt.xticks(np.arange(-1, 1.1, 0.2))\nplt.yticks(np.arange(-1, 1.1, 0.2))\n\nplt.axhline(y=0, color=\"black\", linestyle=\"--\")\nplt.axvline(x=0, color=\"black\", linestyle=\"--\")\ncircle = plt.Circle((0, 0), 0.99, color=\"gray\", fill=False)\nplt.gca().add_artist(circle)\n\nplt.grid()\nplt.show()\n```\n\n![Image 8 - Variable biplot \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1IUPcvWStug6kdmD98c_NVQ.png)\nImage 8 - Variable biplot (image by author)\nSo, what are you looking at? This is what you should know when interpreting biplots:\n  * **Arrow direction:** Indicates how the corresponding variable is aligned with the principal component. Arrows that point in the same direction are positively correlated. Arrows pointing in the opposite direction are negatively correlated.\n  * **Arrow length:** Shows how much the variable contributes to the principal components. Longer arrows mean stronger contribution (the variable accounts for more explained variance). Shorter arrows mean weaker contribution (the variable accounts for less explained variance).\n  * **Angle between arrows:** 0º indicates a perfect positive correlation. 180º indicates a perfect negative correlation. 90º indicates no correlation.\n\n\nFrom the above chart, you can see how the features `sulphates`, `fixed acidity`, and `citric accid` show a high correlation.\n## PCA Plot #5: Loading Score Plot\n**Question:** Which variables from the original dataset have the most influence on each principal component?\nYou can visualize something known as a _loading score_ to find out. It's a value that represents the weight of an original variable to a given principal component. A higher absolute value indicates higher influence.\nThese are essentially correlations with a principal component and range from -1 to +1. You don't often care about the direction, just the magnitude.\npython\n\n```\nloadings = pd.DataFrame(\n    data=pca.components_.T * np.sqrt(pca.explained_variance_), \n    columns=[f\"PC{i}\" for i in range(1, len(X.columns) + 1)],\n    index=X.columns\n)\n\nfig, axs = plt.subplots(2, 2, figsize=(14, 10), sharex=True, sharey=True)\ncolors = [\"#1C3041\", \"#9B1D20\", \"#0B6E4F\", \"#895884\"]\n\nfor i, ax in enumerate(axs.flatten()):\n    explained_variance = pca.explained_variance_ratio_[i] * 100\n    pc = f\"PC{i+1}\"\n    bars = ax.bar(loadings.index, loadings[pc], color=colors[i], edgecolor=\"#000000\", linewidth=1.2)\n    ax.set_title(f\"{pc} Loading Scores ({explained_variance:.2f}% Explained Variance)\", loc=\"left\", fontdict={\"weight\": \"bold\"}, y=1.06)\n    ax.set_xlabel(\"Feature\")\n    ax.set_ylabel(\"Loading Score\")\n    ax.grid(axis=\"y\")\n    ax.tick_params(axis=\"x\", rotation=90)\n    ax.set_ylim(-1, 1)\n\n    for bar in bars:\n        yval = bar.get_height()\n        offset = yval + 0.02 if yval > 0 else yval - 0.15\n        ax.text(bar.get_x() + bar.get_width() / 2, offset, f\"{yval:.2f}\", ha=\"center\", va=\"bottom\")\n\nplt.tight_layout()\nplt.show()\n```\n\n![Image 9 - Loading scores for the first four principal components \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1dZqnKehMCggOdS0MPQc_VQ.png)\nImage 9 - Loading scores for the first four principal components (image by author)\nIf the first principal component accounts for ~ 29% of the variability and the `fixed accidity` feature has a high loading score (0.86), it means it's an important feature and should be kept for further analysis and predictive modeling.\nThis way, you can hack your way around loading scores to use them as a feature selection technique.\n## Summing up Python PCA Visualizations\nTo conclude, PCA is a must-know technique for reducing dimensionality and gaining insights. We humans suck at interpreting long lists of numbers, so visualization is the way to go.\nThanks to PCA, you can visualize high-dimensional datasets with 2D/3D charts. You'll lose some variance along the way, so interpret your visualizations carefully.\n_Which PCA visualizations do you use in data science projects?_ Make sure to let me know in the comment section below.\n* * *\n[**Join my newsletter to receive exclusive content on Python, Data Science, and Machine Learning.**](https://darioradecic.substack.com)\n> [**Dario's Substack | Dario Radecic | Substack**](https://darioradecic.substack.com/)\n_Originally published at_[ _https://darioradecic.substack.com_](https://darioradecic.substack.com/p/top-5-pca-visualizations) _._\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657095692_93hujy.png)\nWritten By\n## [Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nhttps://writingfordevs.substack.com\n[See all from Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\n[Data Science](https://towardsdatascience.com/tag/data-science/)[Data Visualization](https://towardsdatascience.com/tag/data-visualization/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Python](https://towardsdatascience.com/tag/python/)[Towards Data Science](https://towardsdatascience.com/tag/towards-data-science/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2F5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d%2F&title=5%20PCA%20Visualizations%20You%20Must%20Try%20On%20Your%20Next%20Data%20Science%20Project)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2F5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d%2F&title=5%20PCA%20Visualizations%20You%20Must%20Try%20On%20Your%20Next%20Data%20Science%20Project)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2F5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d%2F&text=5%20PCA%20Visualizations%20You%20Must%20Try%20On%20Your%20Next%20Data%20Science%20Project)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/09/1tIBdVhWgE1BvArXflXP9qQ-scaled.jpeg)](https://towardsdatascience.com/dont-panic-if-you-ever-make-the-wrong-git-commit-i-ve-got-you-covered-e7cd8d196130/)\n## [Don't Panic If You Ever Make the Wrong Git Commit. I've Got You Covered](https://towardsdatascience.com/dont-panic-if-you-ever-make-the-wrong-git-commit-i-ve-got-you-covered-e7cd8d196130/)\n[Coding](https://towardsdatascience.com/category/programming/coding/)\nA small guide to interactive rebase. This command allows you to Change the past and undo a commit\n[Twan Chen](https://towardsdatascience.com/author/twanchen/)\nSeptember 4, 20217 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/01/1VPKibMI4VXNrdlWk4dkoFQ-scaled.jpeg)](https://towardsdatascience.com/machine-learning-102-logistic-regression-9e6dc2807772/)\n## [Machine Learning 102: Logistic Regression](https://towardsdatascience.com/machine-learning-102-logistic-regression-9e6dc2807772/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nGoing Back to the Basics of Classification\n[Y. Natsume](https://towardsdatascience.com/author/natsunoyuki/)\nJanuary 14, 202217 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/11/030wqNXqglgHbS1ET-scaled.jpg)](https://towardsdatascience.com/which-feature-engineering-techniques-improve-machine-learning-predictions-227d732068f5/)\n## [Which Feature Engineering Techniques improve Machine Learning Predictions?](https://towardsdatascience.com/which-feature-engineering-techniques-improve-machine-learning-predictions-227d732068f5/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nUnderstanding the various feature engineering techniques can be handy for an ML practitioner. After all, features are one of the most...\n[Suhas Maddali](https://towardsdatascience.com/author/suhas-maddali007/)\nNovember 11, 202210 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/11/08nSBGzV1kM4HWaI1-scaled.jpg)](https://towardsdatascience.com/zen-and-the-art-of-data-science-how-to-avoid-gumption-traps-a3590deef870/)\n## [Zen and the Art of Data Science - How To Avoid Gumption Traps](https://towardsdatascience.com/zen-and-the-art-of-data-science-how-to-avoid-gumption-traps-a3590deef870/)\n[Philosophy](https://towardsdatascience.com/category/philosophy/)\nEven the best data scientists face frustration and loss of momentum in their projects. What would philosopher Robert Pirsig have advised...\n[Wouter van Heeswijk, PhD](https://towardsdatascience.com/author/wvheeswijk/)\nNovember 21, 202112 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/12r1bz52rW0PkPC-MPw6tjw.png)](https://towardsdatascience.com/train-neural-net-to-predict-continuous-properties-from-an-image-in-40-lines-of-code-with-pytorch-c3a408a02b52/)\n## [Train a neural net to predict continuous properties from an image in 40 lines of code with PyTorch.](https://towardsdatascience.com/train-neural-net-to-predict-continuous-properties-from-an-image-in-40-lines-of-code-with-pytorch-c3a408a02b52/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nThe goal of this tutorial is how to predict a continuous property like color, fill level from an image in the shortest way possible using...\n[Sagi eppel](https://towardsdatascience.com/author/sagieppel/)\nDecember 11, 20218 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/10/0A6IhOZZ6eWgmhNLy-scaled.jpg)](https://towardsdatascience.com/three-critical-elements-of-data-preprocessing-part-1-3c16f46f8ced/)\n## [Three critical elements of data preprocessing - Part 1](https://towardsdatascience.com/three-critical-elements-of-data-preprocessing-part-1-3c16f46f8ced/)\n[Programming](https://towardsdatascience.com/category/programming/)\nThe backbone of modeling in data science.\n[Abiodun Olaoye](https://towardsdatascience.com/author/aolaoye/)\nOctober 15, 20223 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2018/11/1h-nDSOFdCe4sWvKMkIs4xQ.jpeg)](https://towardsdatascience.com/calculating-d-d-damage-with-tensorflow-88db84604f0a/)\n## [Calculating D&D Damage with Tensorflow](https://towardsdatascience.com/calculating-d-d-damage-with-tensorflow-88db84604f0a/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\n12 class Tensorflow object detection model to count value of rolled dice, inspired by Critical Role and D&D\n[Michael Sugimura](https://towardsdatascience.com/author/michaelsugimura/)\nNovember 5, 201813 min read\n  * [![](https://towardsdatascience.com/images/fallback-image.jpg)](https://towardsdatascience.com/crisp-dm-ready-for-machine-learning-projects-2aad9172056a/)\n## [CRISP-DM ready for Machine Learning Projects](https://towardsdatascience.com/crisp-dm-ready-for-machine-learning-projects-2aad9172056a/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nStructure your Machine Learning projects using the strengths of a well-known Data Mining process model amended by roles and...\n[Linda Wehrstein](https://towardsdatascience.com/author/linda.wehrstein/)\nDecember 19, 20207 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/0-JxZPyEq_JgrM7nj-scaled.jpg)](https://towardsdatascience.com/nlp-working-with-books-fc82d8e9b0dc/)\n## [NLP - Working with Books](https://towardsdatascience.com/nlp-working-with-books-fc82d8e9b0dc/)\n[NLP](https://towardsdatascience.com/category/artificial-intelligence/nlp/)\nWorking with text data is always presenting us with new challenges. Today I'm going to go over one particular kind of text data that can...\n[Kourosh Alizadeh](https://towardsdatascience.com/author/kcalizadeh/)\nJanuary 18, 20217 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "5 PCA Visualizations You Must Try On Your Next Data Science Project | Towards Data Science",
    "description": "Which features carry the most weight? How do original features contribute to principal components? These 5 visualization types have the...",
    "keywords": null,
    "author": "Dario Radečić",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "5 PCA Visualizations You Must Try On Your Next Data Science Project",
    "og:description": "Which features carry the most weight? How do original features contribute to principal components? These 5 visualization types have the...",
    "og:url": "https://towardsdatascience.com/5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/0ovHhFWEqO1P0Cm4u-scaled.jpg",
    "og:image:width": "1707",
    "og:image:height": "2560",
    "og:image:type": "image/jpeg",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Dario Radečić",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "8 min read",
    "article:published_time": "2024-08-02T14:01:31.000Z",
    "article:modified_time": "2024-08-02T14:01:31.000Z",
    "article:author": "https://towardsdatascience.com/author/radecicdario/"
  },
  "paywall": {
    "listed_paid": true,
    "detected": false,
    "marker": "",
    "public_only": true,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_000.txt",
      "chars": 217
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_001.txt",
      "chars": 274
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_002.txt",
      "chars": 668
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_003.txt",
      "chars": 584
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_004.txt",
      "chars": 598
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_005.txt",
      "chars": 756
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_006.txt",
      "chars": 890
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_007.txt",
      "chars": 41
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_008.txt",
      "chars": 903
    },
    {
      "language": "txt",
      "file": "attachments/6907259ffe3a/code/block_009.txt",
      "chars": 1058
    }
  ],
  "images": [
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/0ovHhFWEqO1P0Cm4u-scaled.jpg",
      "alt": "Photo by Andrew Neel on Unsplash",
      "local_path": "attachments/6907259ffe3a/images/000.jpg",
      "bytes": 350717,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1qi0aYSKWOP90J7l3tzh2pQ.png",
      "alt": "Image 1 - Head of the Wine quality dataset (image by author)",
      "local_path": "attachments/6907259ffe3a/images/001.png",
      "bytes": 39326,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1WGwcO9y38Cw1H_OuPoFHdA.png",
      "alt": "Image 2 - Wine quality dataset after applying PCA (image by author)",
      "local_path": "attachments/6907259ffe3a/images/002.png",
      "bytes": 51257,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1r5UVsuNgOT_ZQnF7fQOmsw.png",
      "alt": "Image 3 - Explained variance plot (image by author)",
      "local_path": "attachments/6907259ffe3a/images/003.png",
      "bytes": 30964,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1CJpQTNpAs5z-K3Z8d3kkjw.png",
      "alt": "Image 4 - Cumulative explained variance plot (image by author)",
      "local_path": "attachments/6907259ffe3a/images/004.png",
      "bytes": 75680,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1znk99dwXbjK9d-hyQroKow.png",
      "alt": "Image 5 - Scatter plot of the first two principal components (image by author)",
      "local_path": "attachments/6907259ffe3a/images/005.png",
      "bytes": 640432,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/13WKUz_i-RVpy7TXgKJVxlA.png",
      "alt": "Image 6 - Scatter plot of the first three principal components (image by author)",
      "local_path": "attachments/6907259ffe3a/images/006.png",
      "bytes": 575473,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1HlSzXYNf7gzpdBhYRWLheg.gif",
      "alt": "Image 7 - Tweaking 3D scatter plot angle (image by author)",
      "local_path": "attachments/6907259ffe3a/images/007.gif",
      "bytes": 1814773,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1IUPcvWStug6kdmD98c_NVQ.png",
      "alt": "Image 8 - Variable biplot (image by author)",
      "local_path": "attachments/6907259ffe3a/images/008.png",
      "bytes": 101669,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/08/1dZqnKehMCggOdS0MPQc_VQ.png",
      "alt": "Image 9 - Loading scores for the first four principal components (image by author)",
      "local_path": "attachments/6907259ffe3a/images/009.png",
      "bytes": 99645,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/09/1tIBdVhWgE1BvArXflXP9qQ-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/010.jpeg",
      "bytes": 215900,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/01/1VPKibMI4VXNrdlWk4dkoFQ-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/011.jpeg",
      "bytes": 1119235,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/11/030wqNXqglgHbS1ET-scaled.jpg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/012.jpg",
      "bytes": 586127,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/11/08nSBGzV1kM4HWaI1-scaled.jpg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/013.jpg",
      "bytes": 618357,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/12r1bz52rW0PkPC-MPw6tjw.png",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/014.png",
      "bytes": 912,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/10/0A6IhOZZ6eWgmhNLy-scaled.jpg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/015.jpg",
      "bytes": 666717,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2018/11/1h-nDSOFdCe4sWvKMkIs4xQ.jpeg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/016.jpeg",
      "bytes": 184392,
      "downloaded": true
    },
    {
      "src": "/images/fallback-image.jpg",
      "alt": "",
      "local_path": "",
      "bytes": 0,
      "downloaded": false
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/0-JxZPyEq_JgrM7nj-scaled.jpg",
      "alt": "",
      "local_path": "attachments/6907259ffe3a/images/018.jpg",
      "bytes": 447228,
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [
    {
      "src": "https://www.youtube.com/c/TowardsDataScience",
      "quality": "unavailable",
      "local_path": "",
      "note": "无1080p且无720p，未交付更低清晰度"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/radecicdario/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/principal-component-analysis-pca-from-scratch-in-python-7f3e2a540c51"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-visualization/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/python/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/towards-data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/dont-panic-if-you-ever-make-the-wrong-git-commit-i-ve-got-you-covered-e7cd8d196130/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/programming/coding/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/twanchen/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/machine-learning-102-logistic-regression-9e6dc2807772/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/natsunoyuki/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://unsplash.com/@andrewtneel"
    },
    {
      "type": "external",
      "href": "https://unsplash.com"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-data-scientist"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/machine-learning"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/data-analyst"
    },
    {
      "type": "external",
      "href": "https://www.kaggle.com/datasets/yasserh/wine-quality-dataset"
    },
    {
      "type": "external",
      "href": "https://creativecommons.org/publicdomain/zero/1.0/"
    },
    {
      "type": "external",
      "href": "https://betterdatascience.com/top-3-matplotlib-tips/"
    },
    {
      "type": "external",
      "href": "https://fonts.google.com/specimen/Roboto+Condensed"
    },
    {
      "type": "external",
      "href": "https://matplotlib.org/stable/api/_as_gen/mpl_toolkits.mplot3d.axes3d.Axes3D.view_init.html"
    },
    {
      "type": "external",
      "href": "https://darioradecic.substack.com"
    },
    {
      "type": "external",
      "href": "https://darioradecic.substack.com/"
    },
    {
      "type": "external",
      "href": "https://darioradecic.substack.com/p/top-5-pca-visualizations"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=5+PCA+Visualizations+You+Must+Try+On+Your+Next+Data+Science+Project&u=https%3A%2F%2Ftowardsdatascience.com%2F5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=5+PCA+Visualizations+You+Must+Try+On+Your+Next+Data+Science+Project&url=https%3A%2F%2Ftowardsdatascience.com%2F5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=5+PCA+Visualizations+You+Must+Try+On+Your+Next+Data+Science+Project&url=https%3A%2F%2Ftowardsdatascience.com%2F5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T11:11:48Z",
  "source_url": "https://towardsdatascience.com/5-pca-visualizations-you-must-try-on-your-next-data-science-project-148ec3d31e4d/",
  "delivery_status": "excluded_paid",
  "discovery_status": "excluded_paid",
  "missing_reason": "按原约定排除付费/会员全文"
}