Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:15:07+00:00 2026-06-04T08:15:07+00:00

simply, given an initial color #1010CA and an alpha factor 0.5, how can I

  • 0

simply, given an initial color “#1010CA” and an alpha factor 0.5, how can I get the final color that is shown on the plot in terms of color="#1010CA", alpha=0.5?

or more straightforwardly, what should I fill in

plot(x, y, color=__)

so that it is equivalent (at least visually) to

plot(x, y, color="#1010CA", alpha=0.5)

? I guess it shouldn’t be a python question, instead how to manipulate the rgb colors by some factor to damp it, but forgive my ignorance in color palettes…

EDIT

Here is the current solution I opt for after taking @Blender’s answer

import matplotlib
import numpy as np
def alpha_blending(hex_color, alpha) :
    """ alpha blending as if on the white background.
    """
    foreground_tuple  = matplotlib.colors.hex2color(hex_color)
    foreground_arr = np.array(foreground_tuple)
    final = tuple( (1. -  alpha) + foreground_arr*alpha )
    return(final)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:15:08+00:00Added an answer on June 4, 2026 at 8:15 am

    You can’t get a “final color” without the background color as well.

    But for rendering alpha transparency, I would guess that a weighted sum would work:

    final = (1 - alpha) * background + alpha * foreground
    

    So if your color is white and your alpha = 0.5, you can do:

    final = rgb(0.5, 0.5, 0.5) + foreground / 2
    

    Matplotlib accepts RGB tuples so you can make an opacity flattening function pretty easily. Why you need to do this, however, is not something I can answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a String that is simply a day, for example, Thu or Thursday, how
Simple task: given that an article has many comments, be able to display in
Given a simple namespaced route map.namespace :api do |api| api.resources :genres end how can
Given a div square and given I already have a touchmove function on that
Note that I'm mirroring the example given here very closely. In fact, my situation
Given this code: public class Car { public virtual int CarId { get; set;
I am given 100 dollars and told that I have to do the following
I have this rather simple question about Scala. Given that i have to following
Given the simplicity of writing a server side proxy that fetches data across domains,
I want to do a very simple job: given a string containing pronouns, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.