Created
June 28, 2024 13:46
-
-
Save Richy-Z/aaf6cd7e7f8f24b5b29ee14ef932d5d8 to your computer and use it in GitHub Desktop.
UK General Election Predictions June 2024 - matplotlib python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Aberafan Maesteg - Labour | |
| Aberdeen North - SNP | |
| Aberdeen South - SNP | |
| Aberdeenshire North and Moray East - SNP | |
| Aberdeenshire West and Kincardine - SNP | |
| Airdrie and Shotts - Labour | |
| Aldershot - Labour | |
| Aldridge-Brownhills - Conservatives | |
| Alloa and Grangemouth - SNP | |
| Altrincham and Sale West - Labour | |
| Alyn and Deeside - Labour | |
| Amber Valley - Labour | |
| Angus and Perthshire Glens - SNP | |
| Arbroath and Broughty Ferry - SNP | |
| Argyll, Bute and South Lochaber - SNP | |
| Arundel and South Downs - Conservatives | |
| Ashfield - Reform | |
| Ashford - Labour | |
| Ashton under Lyne - Labour | |
| Aylesbury - Labour | |
| Ayr Carrick and Cumnock - Labour | |
| Ayrshire Central - Labour | |
| Ayrshire North and Arran - SNP | |
| Banbury - Labour | |
| Bangor Aberconwy - Labour | |
| Barking - Labour | |
| Barnsley North - Labour | |
| Barnsley South - Reform | |
| Barrow and Furness - Labour | |
| Basildon and Billericay - Labour | |
| Basildon South and East Thurrock - Labour | |
| Basingstoke - Labour | |
| Bassetlaw - Labour | |
| Bath - Lib Dems | |
| Bathgate and Linlithgow - Labour | |
| Battersea - Labour | |
| Beaconsfield - Lib Dems | |
| Beckenham and Penge - Labour | |
| Bedford - Labour | |
| Bedfordshire Mid - Labour | |
| Bedfordshire North - Conservatives | |
| Bermondsey and Old Southwark - Lib Dems | |
| Berwickshire, Roxburgh and Selkirk - SNP | |
| Bethnal Green and Stepney - Labour | |
| Beverley and Holderness - Labour | |
| Bexhill and Battle - Labour | |
| Bexleyheath and Crayford - Labour | |
| Bicester and Woodstock - Lib Dems | |
| Birkenhead - Labour | |
| Birmingham Edgbaston - Labour | |
| Birmingham Erdington - Labour | |
| Birmingham Hall Green and Moseley - Labour | |
| Birmingham Hodge Hill and Solihull North - Labour | |
| Birmingham Ladywood - Labour | |
| Birmingham Northfield - Labour | |
| Birmingham Perry Barr - Labour | |
| Birmingham Selly Oak - Labour | |
| Birmingham Yardley - Labour | |
| Bishop Auckland - Labour | |
| Blackburn - Labour | |
| Blackley and Middleton South - Labour | |
| Blackpool North and Fleetwood - Labour | |
| Blackpool South - Labour | |
| Blaenau Gwent and Rhymney - Labour | |
| Blaydon and Consett - Labour | |
| Blyth and Ashington - Labour | |
| Bognor Regis and Littlehampton - Labour | |
| Bolsover - Labour | |
| Bolton North East - Labour | |
| Bolton South and Walkden - Labour | |
| Bolton West - Labour | |
| Bootle - Labour | |
| Boston and Skegness - Reform | |
| Bournemouth East - Labour | |
| Bournemouth West - Labour | |
| Bracknell - Labour | |
| Bradford East - Labour | |
| Bradford South - Labour | |
| Bradford West - Labour | |
| Braintree - Conservatives | |
| Brecon, Radnor and Cwm Tawe - Lib Dems | |
| Brent East - Labour | |
| Brent West - Labour | |
| Brentford and Isleworth - Labour | |
| Brentwood and Ongar - Labour | |
| Bridgend - Labour | |
| Bridgwater - Labour | |
| Bridlington and the Wolds - Conservatives | |
| Brigg and Immingham - Labour | |
| Brighton Kemptown and Peacehaven - Labour | |
| Brighton Pavilion - Green | |
| Bristol Central - Green | |
| Bristol East - Labour | |
| Bristol North East - Labour | |
| Bristol North West - Labour | |
| Bristol South - Labour | |
| Broadland and Fakenham - Reform | |
| Bromley and Biggin Hill - Labour | |
| Bromsgrove - Labour | |
| Broxbourne - Conservatives | |
| Broxtowe - Labour | |
| Buckingham and Bletchley - Labour | |
| Buckinghamshire Mid - Conservatives | |
| Burnley - Labour | |
| Burton and Uttoxeter - Reform | |
| Bury North - Labour | |
| Bury South - Labour | |
| Bury St Edmunds and Stowmarket - Labour | |
| Caerphilly - Labour | |
| Caithness Sutherland and Easter Ross - Lib Dems | |
| Calder Valley - Labour | |
| Camborne and Redruth - Labour | |
| Cambridge - Lib Dems | |
| Cambridgeshire North East - Conservatives | |
| Cambridgeshire North West - Labour | |
| Cambridgeshire South - Lib Dems | |
| Cannock Chase - Reform | |
| Canterbury - Labour | |
| Cardiff East - Labour | |
| Cardiff North - Labour | |
| Cardiff South and Penarth - Labour | |
| Cardiff West - Labour | |
| Carlisle - Labour | |
| Carmarthen - Plaid Cymur | |
| Carshalton and Wallington - Lib Dems | |
| Castle Point - Labour | |
| Ceredigion Preseli - Plaid Cymur | |
| Chatham and Aylesford - Labour | |
| Cheadle - Lib Dems | |
| Chelmsford - Lib Dems | |
| Chelsea and Fulham - Labour | |
| Cheltenham - Lib Dems | |
| Chesham and Amersham - Lib Dems | |
| Cheshire Mid - Labour | |
| Chester North and Neston - Labour | |
| Chester South and Eddisbury - Labour | |
| Chesterfield - Labour | |
| Chichester - Lib Dems | |
| Chingford and Woodford Green - Conservatives | |
| Chippenham - Lib Dems | |
| Chipping Barnet - Labour | |
| Chorley - Labour | |
| Christchurch - Conservatives | |
| Cities of London and Westminster - Labour | |
| Clacton - Reform | |
| Clapham and Brixton Hill - Labour | |
| Clwyd East - Labour | |
| Clwyd North - Labour | |
| Coatbridge and Bellshill - Labour | |
| Colchester - Labour | |
| Colne Valley - Labour | |
| Congleton - Labour | |
| Corby and East Northamptonshire - Labour | |
| Cornwall North - Lib Dems | |
| Cornwall South East - Labour | |
| Cotswolds North - Reform | |
| Cotswolds South - Lib Dems | |
| Coventry East - Labour | |
| Coventry North West - Labour | |
| Coventry South - Labour | |
| Cowdenbeath and Kirkcaldy - Labour | |
| Cramlington and Killingworth - Labour | |
| Crawley - Labour | |
| Crewe and Nantwich - Labour | |
| Croydon East - Labour | |
| Croydon South - Labour | |
| Croydon West - Labour | |
| Cumbernauld and Kirkintilloch - SNP | |
| Dagenham and Rainham - Labour | |
| Darlington - Labour | |
| Dartford - Labour | |
| Daventry - Labour | |
| Derby North - Labour | |
| Derby South - Labour | |
| Derbyshire Dales - Labour | |
| Derbyshire Mid - Labour | |
| Derbyshire North East - Conservatives | |
| Derbyshire South - Labour | |
| Devon Central - Labour | |
| Devon North - Lib Dems | |
| Devon South - Conservatives | |
| Devon South West - Labour | |
| Dewsbury and Batley - Labour | |
| Didcot and Wantage - Lib Dems | |
| Doncaster Central - Labour | |
| Doncaster East and the Isle of Axholme - Labour | |
| Doncaster North - Labour | |
| Dorking and Horley - Lib Dems | |
| Dorset Mid and Poole North - Conservatives | |
| Dorset North - Conservatives | |
| Dorset South - Labour | |
| Dorset West - Lib Dems | |
| Dover and Deal - Labour | |
| Droitwich and Evesham - Conservatives | |
| Dudley - Labour | |
| Dulwich and West Norwood - Labour | |
| Dumfries and Galloway - SNP | |
| Dumfriesshire, Clydesdale and Tweeddale - Labour | |
| Dunbartonshire West - Labour | |
| Dundee Central - Labour | |
| Dunfermline and Dollar - SNP | |
| Dunstable and Leighton Buzzard - Conservatives | |
| Durham North - Labour | |
| Durham, City of - Labour | |
| Dwyfor Meirionnydd - Plaid Cymur | |
| Ealing Central and Acton - Labour | |
| Ealing North - Labour | |
| Ealing Southall - Labour | |
| Earley and Woodley - Labour | |
| Easington - Labour | |
| East Grinstead and Uckfield - Conservatives | |
| East Ham - Labour | |
| East Kilbride and Strathaven - Labour | |
| Eastbourne - Lib Dems | |
| Eastleigh - Lib Dems | |
| Edinburgh East and Musselburgh - SNP | |
| Edinburgh North and Leith - SNP | |
| Edinburgh South - Labour | |
| Edinburgh South West - Labour | |
| Edinburgh West - Lib Dems | |
| Edmonton and Winchmore Hill - Labour | |
| Ellesmere Port and Bromborough - Labour | |
| Eltham and Chislehurst - Labour | |
| Ely and East Cambridgeshire - Conservatives | |
| Enfield North - Labour | |
| Epping Forest - Conservatives | |
| Epsom and Ewell - Lib Dems | |
| Erewash - Labour | |
| Erith and Thamesmead - Labour | |
| Esher and Walton - Lib Dems | |
| Essex North West - Labour | |
| Exeter - Labour | |
| Exmouth and Exeter East - Conservatives | |
| Falkirk - SNP | |
| Fareham and Waterlooville - Reform | |
| Farnham and Bordon - Lib Dems | |
| Faversham and Kent Mid - Labour | |
| Feltham and Heston - Labour | |
| Fife North East - Lib Dems | |
| Filton and Bradley Stoke - Labour | |
| Finchley and Golders Green - Conservatives | |
| Folkestone and Hythe - Labour | |
| Forest of Dean - Conservatives | |
| Frome and East Somerset - Lib Dems | |
| Fylde - Labour | |
| Gainsborough - Labour | |
| Gateshead Central and Whickham - Labour | |
| Gedling - Labour | |
| Gillingham and Rainham - Labour | |
| Glasgow East - Labour | |
| Glasgow North - Labour | |
| Glasgow North East - Labour | |
| Glasgow South - Labour | |
| Glasgow South West - SNP | |
| Glasgow West - Labour | |
| Glastonbury and Somerton - Lib Dems | |
| Glenrothes and Mid Fife - SNP | |
| Gloucester - Labour | |
| Godalming and Ash - Lib Dems | |
| Goole and Pocklington - Conservatives | |
| Gordon and Buchan - SNP | |
| Gorton and Denton - Labour | |
| Gosport - Reform | |
| Gower - Labour | |
| Grantham and Bourne - Labour | |
| Gravesham - Labour | |
| Great Grimsby and Cleethorpes - Labour | |
| Great Yarmouth - Reform | |
| Greenwich and Woolwich - Labour | |
| Guildford - Lib Dems | |
| Hackney North and Stoke Newington - Labour | |
| Hackney South and Shoreditch - Labour | |
| Halesowen - Labour | |
| Halifax - Labour | |
| Hamble Valley - Conservatives | |
| Hamilton and Clyde Valley - Labour | |
| Hammersmith and Chiswick - Labour | |
| Hampshire East - Conservatives | |
| Hampshire North East - Conservatives | |
| Hampshire North West - Conservatives | |
| Hampstead and Highgate - Labour | |
| Harborough, Oadby and Wigston - Labour | |
| Harlow - Conservatives | |
| Harpenden and Berkhamsted - Lib Dems | |
| Harrogate and Knaresborough - Lib Dems | |
| Harrow East - Labour | |
| Harrow West - Labour | |
| Hartlepool - Labour | |
| Harwich and North Essex - Labour | |
| Hastings and Rye - Labour | |
| Havant - Labour | |
| Hayes and Harlington - Labour | |
| Hazel Grove - Lib Dems | |
| Hemel Hempstead - Labour | |
| Hendon - Labour | |
| Henley and Thame - Lib Dems | |
| Hereford and South Herefordshire - Labour | |
| Herefordshire North - Green | |
| Herne Bay and Sandwich - Conservatives | |
| Hertford and Stortford - Labour | |
| Hertfordshire North East - Labour | |
| Hertfordshire South West - Labour | |
| Hertsmere - Labour | |
| Hexham - Labour | |
| Heywood and Middleton North - Labour | |
| High Peak - Labour | |
| Hinckley and Bosworth - Lib Dems | |
| Hitchin - Labour | |
| Holborn and St Pancras - Labour | |
| Honiton and Sidmouth - Lib Dems | |
| Hornchurch and Upminster - Conservatives | |
| Hornsey and Friern Barnet - Labour | |
| Horsham - Lib Dems | |
| Houghton and Sunderland South - Labour | |
| Hove and Portslade - Labour | |
| Huddersfield - Labour | |
| Hull East - Labour | |
| Huntingdon - Reform | |
| Hyndburn - Labour | |
| Ilford North - Labour | |
| Ilford South - Labour | |
| Inverclyde and Renfrewshire West - Labour | |
| Inverness, Skye and West Ross-shire - SNP | |
| Ipswich - Labour | |
| Isle of Wight East - Labour | |
| Isle of Wight West - Labour | |
| Islington North - Independent | |
| Islington South and Finsbury - Labour | |
| Jarrow and Gateshead East - Labour | |
| Keighley and Ilkley - Conservatives | |
| Kenilworth and Southam - Conservatives | |
| Kensington and Bayswater - Labour | |
| Kettering - Labour | |
| Kilmarnock and Loudoun - Labour | |
| Kingston and Surbiton - Lib Dems | |
| Kingston upon Hull North and Cottingham - Labour | |
| Kingston upon Hull West and Haltemprice - Labour | |
| Kingswinford and South Staffordshire - Conservatives | |
| Knowsley - Labour | |
| Lancashire West - Labour | |
| Lancaster and Wyre - Labour | |
| Leeds Central and Headingley - Labour | |
| Leeds East - Labour | |
| Leeds North East - Labour | |
| Leeds North West - Labour | |
| Leeds South - Labour | |
| Leeds South West and Morley - Labour | |
| Leeds West and Pudsey - Labour | |
| Leicester East - Labour | |
| Leicester South - Labour | |
| Leicester West - Labour | |
| Leicestershire Mid - Labour | |
| Leicestershire North West - Labour | |
| Leicestershire South - Conservatives | |
| Leigh and Atherton - Labour | |
| Lewes - Lib Dems | |
| Lewisham East - Labour | |
| Lewisham North - Labour | |
| Lewisham West and East Dulwich - Labour | |
| Leyton and Wanstead - Labour | |
| Lichfield - Labour | |
| Lincoln - Labour | |
| Liverpool Garston - Labour | |
| Liverpool Riverside - Labour | |
| Liverpool Walton - Labour | |
| Liverpool Wavertree - Labour | |
| Liverpool West Derby - Labour | |
| Livingston - Labour | |
| Llanelli - Labour | |
| Lothian East - Labour | |
| Loughborough - Labour | |
| Louth and Horncastle - Reform | |
| Lowestoft - Labour | |
| Luton North - Labour | |
| Luton South and South Bedfordshire - Labour | |
| Macclesfield - Labour | |
| Maidenhead - Conservatives | |
| Maidstone and Malling - Conservatives | |
| Makerfield - Labour | |
| Maldon - Conservatives | |
| Manchester Central - Labour | |
| Manchester Rusholme - Labour | |
| Manchester Withington - Labour | |
| Mansfield - Labour | |
| Melksham and Devizes - Lib Dems | |
| Melton and Syston - Labour | |
| Meriden and Solihull East - Labour | |
| Merthyr Tydfil and Aberdare - Labour | |
| Mid Dunbartonshire - Lib Dems | |
| Middlesbrough and Thornaby East - Labour | |
| Middlesbrough South and Cleveland East - Labour | |
| Midlothian - Labour | |
| Milton Keynes Central - Labour | |
| Milton Keynes North - Labour | |
| Mitcham and Morden - Labour | |
| Monmouthshire - Labour | |
| Montgomeryshire and Glyndwr - Labour | |
| Moray West, Nairn and Strathspey - SNP | |
| Morecambe and Lunesdale - Labour | |
| Motherwell, Wishaw and Carluke - SNP | |
| Na h-Eileanan An Iar (Western Isles) - SNP | |
| Neath and Swansea East - Labour | |
| New Forest East - Conservatives | |
| New Forest West - Conservatives | |
| Newark - Labour | |
| Newbury - Conservatives | |
| Newcastle upon Tyne Central and West - Labour | |
| Newcastle upon Tyne East and Wallsend - Labour | |
| Newcastle upon Tyne North - Labour | |
| Newcastle-under-Lyme - Labour | |
| Newport East - Labour | |
| Newport West and Islwyn - Labour | |
| Newton Abbot - Lib Dems | |
| Newton Aycliffe and Spennymoor - Labour | |
| Norfolk Mid - Labour | |
| Norfolk North - Lib Dems | |
| Norfolk North West - Conservatives | |
| Norfolk South - Labour | |
| Norfolk South West - Labour | |
| Normanton and Hemsworth - Labour | |
| Northampton North - Labour | |
| Northampton South - Labour | |
| Northamptonshire South - Labour | |
| Northumberland North - Labour | |
| Norwich North - Labour | |
| Norwich South - Labour | |
| Nottingham East - Labour | |
| Nottingham North and Kimberley - Labour | |
| Nottingham South - Labour | |
| Nuneaton - Labour | |
| Old Bexley and Sidcup - Labour | |
| Oldham East and Saddleworth - Labour | |
| Oldham West, Chadderton and Royton - Labour | |
| Orkney and Shetland - Lib Dems | |
| Orpington - Reform | |
| Ossett and Denby Dale - Labour | |
| Oxford East - Labour | |
| Oxford West and Abingdon - Lib Dems | |
| Paisley and Renfrewshire North - Labour | |
| Paisley and Renfrewshire South - Labour | |
| Peckham - Labour | |
| Pembrokeshire Mid and South - Labour | |
| Pendle and Clitheroe - Labour | |
| Penistone and Stocksbridge - Labour | |
| Penrith and Solway - Labour | |
| Perth and Kinross-shire - SNP | |
| Peterborough - Labour | |
| Plymouth Moor View - Reform | |
| Plymouth Sutton and Devonport - Labour | |
| Pontefract, Castleford and Knottingley - Labour | |
| Pontypridd - Plaid Cymur | |
| Poole - Conservatives | |
| Poplar and Limehouse - Labour | |
| Portsmouth North - Labour | |
| Portsmouth South - Labour | |
| Preston - Labour | |
| Putney - Labour | |
| Queen's Park and Maida Vale - Labour | |
| Rawmarsh and Conisbrough - Labour | |
| Rayleigh and Wickford - Labour | |
| Reading Central - Labour | |
| Reading West and Mid Berkshire - Labour | |
| Redcar - Labour | |
| Redditch - Labour | |
| Reigate - Labour | |
| Renfrewshire East - Labour | |
| Rhondda and Ogmore - Labour | |
| Ribble South - Labour | |
| Ribble Valley - Labour | |
| Richmond and Northallerton - Labour | |
| Richmond Park - Lib Dems | |
| Rochdale - Labour | |
| Rochester and Strood - Labour | |
| Romford - Labour | |
| Romsey and Southampton North - Conservatives | |
| Rossendale and Darwen - Labour | |
| Rother Valley - Conservatives | |
| Rotherham - Labour | |
| Rugby - Labour | |
| Ruislip, Northwood and Pinner - Conservatives | |
| Runcorn and Helsby - Labour | |
| Runnymede and Weybridge - Lib Dems | |
| Rushcliffe - Labour | |
| Rutherglen - Labour | |
| Rutland and Stamford - Conservatives | |
| Salford - Labour | |
| Salisbury - Lib Dems | |
| Scarborough and Whitby - Labour | |
| Scunthorpe - Labour | |
| Sefton Central - Labour | |
| Selby - Labour | |
| Sevenoaks - Conservatives | |
| Sheffield Brightside and Hillsborough - Labour | |
| Sheffield Central - Labour | |
| Sheffield Hallam - Labour | |
| Sheffield Heeley - Labour | |
| Sheffield South East - Labour | |
| Sherwood Forest - Labour | |
| Shipley - Labour | |
| Shrewsbury - Labour | |
| Shropshire North - Lib Dems | |
| Shropshire South - Conservatives | |
| Sittingbourne and Sheppey - Labour | |
| Skipton and Ripon - Reform | |
| Sleaford and North Hykeham - Labour | |
| Slough - Labour | |
| Smethwick - Labour | |
| Solihull West and Shirley - Labour | |
| Somerset North - Labour | |
| Somerset North East and Hanham - Labour | |
| South Holland and The Deepings - Conservatives | |
| South Shields - Labour | |
| Southampton Itchen - Labour | |
| Southampton Test - Labour | |
| Southend East and Rochford - Labour | |
| Southend West and Leigh - Labour | |
| Southgate and Wood Green - Labour | |
| Southport - Labour | |
| Spelthorne - Labour | |
| Spen Valley - Labour | |
| St Albans - Lib Dems | |
| St Austell and Newquay - Labour | |
| St Helens North - Labour | |
| St Helens South and Whiston - Labour | |
| St Ives - Lib Dems | |
| St Neots and Mid Cambridgeshire - Lib Dems | |
| Stafford - Labour | |
| Staffordshire Moorlands - Labour | |
| Stalybridge and Hyde - Labour | |
| Stevenage - Labour | |
| Stirling and Strathallan - Labour | |
| Stockport - Labour | |
| Stockton North - Labour | |
| Stockton West - Labour | |
| Stoke-on-Trent Central - Labour | |
| Stoke-on-Trent North - Labour | |
| Stoke-on-Trent South - Conservatives | |
| Stone, Great Wyrley and Penkridge - Conservatives | |
| Stourbridge - Labour | |
| Stratford and Bow - Labour | |
| Stratford-on-Avon - Labour | |
| Streatham and Croydon North - Labour | |
| Stretford and Urmston - Labour | |
| Stroud - Labour | |
| Suffolk Central and Ipswich North - Labour | |
| Suffolk Coastal - Conservatives | |
| Suffolk South - Reform | |
| Suffolk West - Labour | |
| Sunderland Central - Labour | |
| Surrey East - Labour | |
| Surrey Heath - Lib Dems | |
| Sussex Mid - Lib Dems | |
| Sussex Weald - Conservatives | |
| Sutton and Cheam - Conservatives | |
| Sutton Coldfield - Labour | |
| Swansea West - Labour | |
| Swindon North - Labour | |
| Swindon South - Labour | |
| Tamworth - Labour | |
| Tatton - Labour | |
| Taunton and Wellington - Lib Dems | |
| Telford - Labour | |
| Tewkesbury - Lib Dems | |
| Thanet East - Labour | |
| Thirsk and Malton - Conservatives | |
| Thornbury and Yate - Lib Dems | |
| Thurrock - Labour | |
| Tipton and Wednesbury - Labour | |
| Tiverton and Minehead - Lib Dems | |
| Tonbridge - Conservatives | |
| Tooting - Labour | |
| Torbay - Lib Dems | |
| Torfaen - Labour | |
| Torridge and Tavistock - Conservatives | |
| Tottenham - Labour | |
| Truro and Falmouth - Labour | |
| Tunbridge Wells - Conservatives | |
| Twickenham - Lib Dems | |
| Tynemouth - Labour | |
| Uxbridge and South Ruislip - Labour | |
| Vale of Glamorgan - Labour | |
| Vauxhall and Camberwell Green - Labour | |
| Wakefield and Rothwell - Labour | |
| Wallasey - Labour | |
| Walsall and Bloxwich - Labour | |
| Walthamstow - Labour | |
| Warrington North - Labour | |
| Warrington South - Labour | |
| Warwick and Leamington - Labour | |
| Warwickshire North and Bedworth - Labour | |
| Washington and Gateshead South - Reform | |
| Watford - Labour | |
| Waveney Valley - Green | |
| Weald of Kent - Conservatives | |
| Wellingborough and Rushden - Labour | |
| Wells and Mendip Hills - Lib Dems | |
| Welwyn Hatfield - Labour | |
| West Bromwich - Labour | |
| West Ham and Beckton - Labour | |
| Westmorland and Lonsdale - Lib Dems | |
| Weston-super-Mare - Labour | |
| Wetherby and Easingwold - Conservatives | |
| Whitehaven and Workington - Labour | |
| Widnes and Halewood - Labour | |
| Wigan - Labour | |
| Wiltshire East - Labour | |
| Wiltshire South West - Labour | |
| Wimbledon - Lib Dems | |
| Winchester - Lib Dems | |
| Windsor - Lib Dems | |
| Wirral West - Labour | |
| Witham - Labour | |
| Witney - Lib Dems | |
| Woking - Lib Dems | |
| Wokingham - Lib Dems | |
| Wolverhampton North East - Labour | |
| Wolverhampton South East - Labour | |
| Wolverhampton West - Labour | |
| Worcester - Labour | |
| Worcestershire West - Labour | |
| Worsley and Eccles - Labour | |
| Worthing East and Shoreham - Labour | |
| Worthing West - Labour | |
| Wrekin, The - Labour | |
| Wrexham - Labour | |
| Wycombe - Labour | |
| Wyre Forest - Labour | |
| Wythenshawe and Sale East - Labour | |
| Yeovil - Lib Dems | |
| Ynys Mon (Anglesey) - Labour | |
| York Central - Labour | |
| York Outer - Labour |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| # Read the data from the file | |
| with open("parties.txt", "r") as file: | |
| data = file.read() | |
| # Parse the data | |
| lines = data.strip().split("\n") | |
| party_counts = {} | |
| for line in lines: | |
| if " - " in line: | |
| constituency, party = line.split(" - ") | |
| if party in party_counts: | |
| party_counts[party] += 1 | |
| else: | |
| party_counts[party] = 1 | |
| # Define colors for the parties | |
| party_colors = { | |
| "Labour": "red", | |
| "Conservatives": "blue", | |
| "SNP": "yellow", | |
| "Reform": "darkblue", | |
| "Lib Dems": "orange", | |
| "Green": "green", | |
| "Plaid Cymru": "forestgreen", | |
| } | |
| # Prepare data for the bar chart | |
| parties = list(party_counts.keys()) | |
| counts = list(party_counts.values()) | |
| colors = [ | |
| party_colors.get(party, "grey") for party in parties | |
| ] # Default to grey if party color is not defined | |
| # Create the bar chart | |
| plt.figure(figsize=(10, 6)) | |
| plt.bar(parties, counts, color=colors) | |
| # Add labels and title | |
| plt.xlabel("Parties") | |
| plt.ylabel("Number of Wins") | |
| plt.title("Number of Wins by Party") | |
| plt.xticks(rotation=45) | |
| # Display the bar chart | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment